Skip to content

Commit a025967

Browse files
committed
update yi-9b sh (#510)
1 parent 03a30bb commit a025967

File tree

6 files changed

+61
-5
lines changed

6 files changed

+61
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Users can check the [documentation of SWIFT](docs/source/GetStarted/快速使用
6464

6565

6666
## 🎉 News
67-
- 2024.03.06: Support training and inference of qwen1.5 awq series, support training and inference of [yi-9b](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_9b/lora_mp_ddp).
67+
- 2024.03.06: Support training and inference of qwen1.5 awq series, support training and inference of [yi-9b](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_9b/lora_zero3).
6868
- 🔥2024.02.29: Support [LLaMA PRO](https://arxiv.org/pdf/2401.02415.pdf), use [this script](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_6b_chat/llamapro/sft.sh) to begin.
6969
- 🔥2024.02.29: Support [LoRA+](https://arxiv.org/pdf/2402.12354.pdf), use [this script](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_6b_chat/lorap/sft.sh) to begin.
7070
- 2024.02.25: Support `swift export` to export models for **AWQ/GPTQ** quantization and push to ModelScope Hub. For more details, please refer to the document: [LLM Quantization Document](https://github.com/modelscope/swift/blob/main/docs/source/LLM/LLM%E9%87%8F%E5%8C%96%E6%96%87%E6%A1%A3.md).

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ SWIFT(Scalable lightWeight Infrastructure for Fine-Tuning)是一个可扩展
6262
用户可以查看 [SWIFT官方文档](docs/source/GetStarted/快速使用.md) 来了解详细信息。
6363

6464
## 🎉 新闻
65-
- 2024.03.06: 支持qwen1.5 awq系列训练与推理, 支持[yi-9b](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_9b/lora_mp_ddp)训练与推理.
65+
- 2024.03.06: 支持qwen1.5 awq系列训练与推理, 支持[yi-9b](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_9b/lora_zero3)训练与推理.
6666
- 🔥2024.02.29: 支持[LLaMA PRO](https://arxiv.org/pdf/2401.02415.pdf), 使用[这个脚本](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_6b_chat/llamapro/sft.sh)即可开始训练.
6767
- 🔥2024.02.29: 支持[LoRA+](https://arxiv.org/pdf/2402.12354.pdf), 使用[这个脚本](https://github.com/modelscope/swift/blob/main/examples/pytorch/llm/scripts/yi_6b_chat/lorap/sft.sh)即可开始训练.
6868
- 2024.02.25: 支持`swift export`, 对模型进行**AWQ/GPTQ**量化导出, 以及推送ModelScope Hub. 具体可以查看文档: [LLM量化文档](https://github.com/modelscope/swift/blob/main/docs/source/LLM/LLM%E9%87%8F%E5%8C%96%E6%96%87%E6%A1%A3.md).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Experimental environment: A100
2+
CUDA_VISIBLE_DEVICES=0 \
3+
swift infer \
4+
--ckpt_dir "output/yi-9b/vx-xxx/checkpoint-xxx" \
5+
--load_dataset_config true \
6+
--max_length 2048 \
7+
--use_flash_attn true \
8+
--max_new_tokens 2048 \
9+
--temperature 0.3 \
10+
--top_p 0.7 \
11+
--repetition_penalty 1. \
12+
--do_sample true \
13+
--merge_lora false \
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Experimental environment: 4 * A100
2+
# 4 * 30GB GPU memory
3+
# Train a chat model with agent capabilities and self-cognition from the base.
4+
nproc_per_node=4
5+
6+
CUDA_VISIBLE_DEVICES=0,1,2,3 \
7+
NPROC_PER_NODE=$nproc_per_node \
8+
swift sft \
9+
--model_type yi-9b \
10+
--sft_type lora \
11+
--tuner_backend swift \
12+
--template_type default \
13+
--dtype AUTO \
14+
--output_dir output \
15+
--dataset ms-agent \
16+
--train_dataset_sample 20000 \
17+
--train_dataset_mix_ratio 2 \
18+
--num_train_epochs 3 \
19+
--max_length 4096 \
20+
--check_dataset_strategy warning \
21+
--lora_rank 8 \
22+
--lora_alpha 32 \
23+
--lora_dropout_p 0.05 \
24+
--lora_target_modules ALL \
25+
--lora_modules_to_save EMBEDDING LN \
26+
--gradient_checkpointing true \
27+
--batch_size 1 \
28+
--weight_decay 0.1 \
29+
--learning_rate 5e-5 \
30+
--gradient_accumulation_steps $(expr 16 / $nproc_per_node) \
31+
--max_grad_norm 0.5 \
32+
--warmup_ratio 0.03 \
33+
--eval_steps 100 \
34+
--save_steps 100 \
35+
--save_total_limit 2 \
36+
--logging_steps 10 \
37+
--use_flash_attn false \
38+
--self_cognition_sample 2000 \
39+
--model_name 小黄 'Xiao Huang' \
40+
--model_author 魔搭 ModelScope \

examples/pytorch/llm/scripts/yi_9b/lora_mp_ddp/sft.sh renamed to examples/pytorch/llm/scripts/yi_9b/lora_zero3/sft.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
# 4 * 22GB GPU memory
33
# Train a chat model with agent capabilities and self-cognition from the base.
44

5+
nproc_per_node=4
6+
57
CUDA_VISIBLE_DEVICES=0,1,2,3 \
6-
NPROC_PER_NODE=2 \
8+
NPROC_PER_NODE=$nproc_per_node \
79
swift sft \
810
--model_type yi-9b \
911
--sft_type lora \
1012
--tuner_backend swift \
11-
--template_type yi \
13+
--template_type default \
1214
--dtype AUTO \
1315
--output_dir output \
1416
--dataset ms-agent \
@@ -26,7 +28,7 @@ swift sft \
2628
--batch_size 1 \
2729
--weight_decay 0.1 \
2830
--learning_rate 5e-5 \
29-
--gradient_accumulation_steps 16 \
31+
--gradient_accumulation_steps $(expr 16 / $nproc_per_node) \
3032
--max_grad_norm 0.5 \
3133
--warmup_ratio 0.03 \
3234
--eval_steps 100 \
@@ -35,5 +37,6 @@ swift sft \
3537
--logging_steps 10 \
3638
--use_flash_attn false \
3739
--self_cognition_sample 2000 \
40+
--deepspeed default-zero3 \
3841
--model_name 小黄 'Xiao Huang' \
3942
--model_author 魔搭 ModelScope \

0 commit comments

Comments
 (0)