Files
qwen2-7b-classical-zh-instruct/README.md
ModelHub XC 04cec9debc 初始化项目,由ModelHub XC社区提供模型
Model: swift/qwen2-7b-classical-zh-instruct
Source: Original Platform
2026-09-30 21:35:14 +08:00

70 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
frameworks:
- Pytorch
license: Apache License 2.0
tasks:
- text-generation
#model-type:
##如 gpt、phi、llama、chatglm、baichuan 等
#- gpt
#domain:
##如 nlp、cv、audio、multi-modal
#- nlp
#language:
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
#- cn
#metrics:
##如 CIDEr、Blue、ROUGE 等
#- CIDEr
#tags:
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
#- pretrained
#tools:
##如 vllm、fastchat、llamacpp、AdaSeq 等
#- vllm
---
模型由SWIFT框架训练,命令:
```shell
CUDA_VISIBLE_DEVICES=0 \
swift sft \
--model_type qwen2-7b-instruct \
--sft_type lora \
--output_dir output \
--dataset classical-chinese-translate \
--num_train_epochs 1 \
--max_length 1024 \
--check_dataset_strategy warning \
--lora_rank 8 \
--lora_alpha 32 \
--lora_dropout_p 0.05 \
--lora_target_modules ALL \
--gradient_checkpointing true \
--batch_size 1 \
--weight_decay 0.1 \
--learning_rate 5e-5 \
--gradient_accumulation_steps 16 \
--max_grad_norm 1.0 \
--warmup_ratio 0.03 \
--eval_steps 100 \
--save_steps 100 \
--save_total_limit 2 \
--logging_steps 10
```
数据集使用的是[古文翻译腔数据集](https://www.modelscope.cn/datasets/swift/classical_chinese_translate)
用来生成古文翻译调调的回复:
```text
Q: 树上有十只鸟,用枪打死一只,还剩多少只?
A: 我听说在大自然中,鸟儿们总是成群结队地飞翔,枪声一响,它们便会四散而逃。如今打死一只,其余的鸟儿岂能不惊慌失措?恐怕连一只也剩不下啊!世间万物,岂能不互相影响?这难道不是显而易见的道理吗?
```
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>