From 64a9cdf6b93bc0fac199304bc61aeb3c35d179f5 Mon Sep 17 00:00:00 2001 From: Jintao Huang Date: Fri, 20 Dec 2024 15:06:14 +0800 Subject: [PATCH 01/11] bump version --- swift/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/version.py b/swift/version.py index 9a09a9153..ef9ab31e9 100644 --- a/swift/version.py +++ b/swift/version.py @@ -1,5 +1,5 @@ # Make sure to modify __release_datetime__ to release time when making official release. -__version__ = '3.0.0.dev0' +__version__ = '3.0.0' # default release datetime for branches under active development is set # to be a time far-far-away-into-the-future __release_datetime__ = '2099-10-13 08:56:12' From 4896c6fb67b7bbc0d02bce4f9475225c7a461237 Mon Sep 17 00:00:00 2001 From: Jintao Huang Date: Sun, 29 Dec 2024 15:32:37 +0800 Subject: [PATCH 02/11] bump version --- swift/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/version.py b/swift/version.py index f8a3cd892..f44966a0f 100644 --- a/swift/version.py +++ b/swift/version.py @@ -1,5 +1,5 @@ # Make sure to modify __release_datetime__ to release time when making official release. -__version__ = '3.0.1' +__version__ = '3.0.1.post1' # default release datetime for branches under active development is set # to be a time far-far-away-into-the-future __release_datetime__ = '2099-10-13 08:56:12' From e9cc74067f826bcd1fdef5f9533611ce6b959cc4 Mon Sep 17 00:00:00 2001 From: Jintao Huang Date: Mon, 6 Jan 2025 11:31:13 +0800 Subject: [PATCH 03/11] bump version --- swift/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/version.py b/swift/version.py index f44966a0f..f0d9c4725 100644 --- a/swift/version.py +++ b/swift/version.py @@ -1,5 +1,5 @@ # Make sure to modify __release_datetime__ to release time when making official release. -__version__ = '3.0.1.post1' +__version__ = '3.0.2' # default release datetime for branches under active development is set # to be a time far-far-away-into-the-future __release_datetime__ = '2099-10-13 08:56:12' From d307635b24bccd31837f422166164bcdb08ecc0e Mon Sep 17 00:00:00 2001 From: Jintao Date: Wed, 8 Jan 2025 12:35:59 +0800 Subject: [PATCH 04/11] update qlora shell (#2880) --- examples/train/qlora/awq.sh | 28 ++++++++++++++++++++++++++++ examples/train/qlora/bnb.sh | 34 ++++++++++++++++++++++++++++++++++ examples/train/qlora/gptq.sh | 28 ++++++++++++++++++++++++++++ examples/train/qlora/hqq.sh | 31 +++++++++++++++++++++++++++++++ tests/llm/test_run.py | 2 +- 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 examples/train/qlora/awq.sh create mode 100644 examples/train/qlora/bnb.sh create mode 100644 examples/train/qlora/gptq.sh create mode 100644 examples/train/qlora/hqq.sh diff --git a/examples/train/qlora/awq.sh b/examples/train/qlora/awq.sh new file mode 100644 index 000000000..f13fb3910 --- /dev/null +++ b/examples/train/qlora/awq.sh @@ -0,0 +1,28 @@ +# 10GB +CUDA_VISIBLE_DEVICES=0 \ +swift sft \ + --model Qwen/Qwen2.5-7B-Instruct-AWQ \ + --train_type lora \ + --dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \ + 'AI-ModelScope/alpaca-gpt4-data-en#500' \ + 'swift/self-cognition#500' \ + --torch_dtype bfloat16 \ + --num_train_epochs 1 \ + --per_device_train_batch_size 1 \ + --per_device_eval_batch_size 1 \ + --learning_rate 1e-4 \ + --lora_rank 8 \ + --lora_alpha 32 \ + --target_modules all-linear \ + --gradient_accumulation_steps 16 \ + --eval_steps 50 \ + --save_steps 50 \ + --save_total_limit 5 \ + --logging_steps 5 \ + --max_length 2048 \ + --output_dir output \ + --system 'You are a helpful assistant.' \ + --warmup_ratio 0.05 \ + --dataloader_num_workers 4 \ + --model_author swift \ + --model_name swift-robot diff --git a/examples/train/qlora/bnb.sh b/examples/train/qlora/bnb.sh new file mode 100644 index 000000000..15e9af010 --- /dev/null +++ b/examples/train/qlora/bnb.sh @@ -0,0 +1,34 @@ +# 10GB +# pip install bitsandbytes +CUDA_VISIBLE_DEVICES=0 \ +swift sft \ + --model Qwen/Qwen2.5-7B-Instruct \ + --train_type lora \ + --dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \ + 'AI-ModelScope/alpaca-gpt4-data-en#500' \ + 'swift/self-cognition#500' \ + --torch_dtype bfloat16 \ + --bnb_4bit_compute_dtype bfloat16 \ + --bnb_4bit_quant_type nf4 \ + --bnb_4bit_use_double_quant true \ + --quant_method bnb \ + --quant_bits 4 \ + --num_train_epochs 1 \ + --per_device_train_batch_size 1 \ + --per_device_eval_batch_size 1 \ + --learning_rate 1e-4 \ + --lora_rank 8 \ + --lora_alpha 32 \ + --target_modules all-linear \ + --gradient_accumulation_steps 16 \ + --eval_steps 50 \ + --save_steps 50 \ + --save_total_limit 5 \ + --logging_steps 5 \ + --max_length 2048 \ + --output_dir output \ + --system 'You are a helpful assistant.' \ + --warmup_ratio 0.05 \ + --dataloader_num_workers 4 \ + --model_author swift \ + --model_name swift-robot diff --git a/examples/train/qlora/gptq.sh b/examples/train/qlora/gptq.sh new file mode 100644 index 000000000..7cb4eefc4 --- /dev/null +++ b/examples/train/qlora/gptq.sh @@ -0,0 +1,28 @@ +# 9GB +CUDA_VISIBLE_DEVICES=0 \ +swift sft \ + --model Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4 \ + --train_type lora \ + --dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \ + 'AI-ModelScope/alpaca-gpt4-data-en#500' \ + 'swift/self-cognition#500' \ + --torch_dtype bfloat16 \ + --num_train_epochs 1 \ + --per_device_train_batch_size 1 \ + --per_device_eval_batch_size 1 \ + --learning_rate 1e-4 \ + --lora_rank 8 \ + --lora_alpha 32 \ + --target_modules all-linear \ + --gradient_accumulation_steps 16 \ + --eval_steps 50 \ + --save_steps 50 \ + --save_total_limit 5 \ + --logging_steps 5 \ + --max_length 2048 \ + --output_dir output \ + --system 'You are a helpful assistant.' \ + --warmup_ratio 0.05 \ + --dataloader_num_workers 4 \ + --model_author swift \ + --model_name swift-robot diff --git a/examples/train/qlora/hqq.sh b/examples/train/qlora/hqq.sh new file mode 100644 index 000000000..8d25afea6 --- /dev/null +++ b/examples/train/qlora/hqq.sh @@ -0,0 +1,31 @@ +# 10GB +# pip install hqq +CUDA_VISIBLE_DEVICES=0 \ +swift sft \ + --model Qwen/Qwen2.5-7B-Instruct \ + --train_type lora \ + --dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \ + 'AI-ModelScope/alpaca-gpt4-data-en#500' \ + 'swift/self-cognition#500' \ + --torch_dtype bfloat16 \ + --quant_method hqq \ + --quant_bits 4 \ + --num_train_epochs 1 \ + --per_device_train_batch_size 1 \ + --per_device_eval_batch_size 1 \ + --learning_rate 1e-4 \ + --lora_rank 8 \ + --lora_alpha 32 \ + --target_modules all-linear \ + --gradient_accumulation_steps 16 \ + --eval_steps 50 \ + --save_steps 50 \ + --save_total_limit 5 \ + --logging_steps 5 \ + --max_length 2048 \ + --output_dir output \ + --system 'You are a helpful assistant.' \ + --warmup_ratio 0.05 \ + --dataloader_num_workers 4 \ + --model_author swift \ + --model_name swift-robot diff --git a/tests/llm/test_run.py b/tests/llm/test_run.py index 783f2ae0d..862710357 100644 --- a/tests/llm/test_run.py +++ b/tests/llm/test_run.py @@ -27,7 +27,7 @@ kwargs = { 'per_device_train_batch_size': 2, 'per_device_eval_batch_size': 2, - 'save_steps': 10, + 'save_steps': 5, 'gradient_accumulation_steps': 4, 'num_train_epochs': 1, } From 33ab2bda10db9f758917b65ec831ce12d21206cd Mon Sep 17 00:00:00 2001 From: Jintao Date: Wed, 8 Jan 2025 17:04:24 +0800 Subject: [PATCH 05/11] fix docs (#2882) --- ...\216\250\347\220\206\345\222\214\351\203\250\347\275\262.md" | 2 +- docs/source_en/Instruction/Inference-and-deployment.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git "a/docs/source/Instruction/\346\216\250\347\220\206\345\222\214\351\203\250\347\275\262.md" "b/docs/source/Instruction/\346\216\250\347\220\206\345\222\214\351\203\250\347\275\262.md" index 76a574b95..ca887b619 100644 --- "a/docs/source/Instruction/\346\216\250\347\220\206\345\222\214\351\203\250\347\275\262.md" +++ "b/docs/source/Instruction/\346\216\250\347\220\206\345\222\214\351\203\250\347\275\262.md" @@ -15,7 +15,7 @@ SWIFT支持以命令行、Python代码和界面方式进行推理和部署: - `single-line`命令 切换到单行模式 - `clear`命令 清除history - `exit`命令 退出 -- 如果query中带有多模态数据,添加/