Skip to content

Commit 58fd32f

Browse files
authored
Fix bugs (#3025)
1 parent 00a5af5 commit 58fd32f

File tree

8 files changed

+47
-20
lines changed

8 files changed

+47
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Running Environment:
110110
| python | >=3.8 | 3.10 | |
111111
| cuda | | cuda12 | No need to install if using CPU, NPU, MPS |
112112
| torch | >=2.0 | | |
113-
| transformers | >=4.33 | 4.48.1 | |
113+
| transformers | >=4.33 | 4.48.2 | |
114114
| modelscope | >=1.19 | | |
115115
| peft | >=0.11.0,<0.15.0 | | |
116116
| trl | >=0.13,<0.15 | 0.14.0 | RLHF |

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pip install -e .
104104
| python | >=3.8 | 3.10 ||
105105
| cuda | | cuda12 |使用cpu、npu、mps则无需安装|
106106
| torch | >=2.0 | ||
107-
| transformers | >=4.33 | 4.48.1 ||
107+
| transformers | >=4.33 | 4.48.2 ||
108108
| modelscope | >=1.19 | ||
109109
| peft | >=0.11.0,<0.15.0 | ||
110110
| trl | >=0.13,<0.15 | 0.14.0 |RLHF|

docs/source/GetStarted/SWIFT安装.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pip install 'ms-swift[all]' -U
1717
## 源代码安装
1818

1919
```shell
20+
# pip install git+https://github.com/modelscope/ms-swift.git
21+
2022
git clone https://github.com/modelscope/ms-swift.git
2123
cd ms-swift
2224
pip install -e .
@@ -43,7 +45,7 @@ pip install ms-swift==2.*
4345
| python | >=3.8 | 3.10 ||
4446
| cuda | | cuda12 |使用cpu、npu、mps则无需安装|
4547
| torch | >=2.0 | ||
46-
| transformers | >=4.33 | 4.48.1 ||
48+
| transformers | >=4.33 | 4.48.2 ||
4749
| modelscope | >=1.19 | ||
4850
| peft | >=0.11.0,<0.15.0 | ||
4951
| trl | >=0.13,<0.15 | 0.14.0 |RLHF|

docs/source_en/GetStarted/SWIFT-installation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ pip install 'ms-swift[all]' -U
1717
## Source Code Installation
1818

1919
```shell
20+
# pip install git+https://github.com/modelscope/ms-swift.git
21+
2022
git clone https://github.com/modelscope/ms-swift.git
2123
cd ms-swift
2224
pip install -e .
@@ -45,7 +47,7 @@ You can view the image [here](https://modelscope.cn/docs/intro/environment-setup
4547
| python | >=3.8 | 3.10 | |
4648
| cuda | | cuda12 | No need to install if using CPU, NPU, MPS |
4749
| torch | >=2.0 | | |
48-
| transformers | >=4.33 | 4.48.1 | |
50+
| transformers | >=4.33 | 4.48.2 | |
4951
| modelscope | >=1.19 | | |
5052
| peft | >=0.11.0,<0.15.0 | | |
5153
| trl | >=0.13,<0.15 | 0.14.0 | RLHF |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# 2 * 76GiB
2+
CUDA_VISIBLE_DEVICES=0,1 \
3+
MAX_PIXELS=1003520 \
4+
swift sft \
5+
--model Qwen/Qwen2-VL-72B-Instruct \
6+
--dataset 'modelscope/coco_2014_caption:validation#20000' \
7+
--train_type lora \
8+
--torch_dtype bfloat16 \
9+
--num_train_epochs 1 \
10+
--per_device_train_batch_size 1 \
11+
--per_device_eval_batch_size 1 \
12+
--learning_rate 1e-4 \
13+
--lora_rank 8 \
14+
--lora_alpha 32 \
15+
--target_modules all-linear \
16+
--freeze_vit true \
17+
--gradient_accumulation_steps 16 \
18+
--eval_steps 100 \
19+
--save_steps 100 \
20+
--save_total_limit 5 \
21+
--logging_steps 5 \
22+
--max_length 2048 \
23+
--output_dir output \
24+
--warmup_ratio 0.05 \
25+
--dataloader_num_workers 4

examples/train/qlora/gptq.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# 9GB
2-
CUDA_VISIBLE_DEVICES=0 \
1+
# 2 * 30GiB
2+
CUDA_VISIBLE_DEVICES=0,1 \
3+
MAX_PIXELS=1003520 \
34
swift sft \
4-
--model Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4 \
5+
--model Qwen/Qwen2-VL-72B-Instruct-GPTQ-Int4 \
6+
--dataset 'modelscope/coco_2014_caption:validation#20000' \
57
--train_type lora \
6-
--dataset 'AI-ModelScope/alpaca-gpt4-data-zh#500' \
7-
'AI-ModelScope/alpaca-gpt4-data-en#500' \
8-
'swift/self-cognition#500' \
98
--torch_dtype bfloat16 \
109
--num_train_epochs 1 \
1110
--per_device_train_batch_size 1 \
@@ -14,15 +13,13 @@ swift sft \
1413
--lora_rank 8 \
1514
--lora_alpha 32 \
1615
--target_modules all-linear \
16+
--freeze_vit true \
1717
--gradient_accumulation_steps 16 \
18-
--eval_steps 50 \
19-
--save_steps 50 \
18+
--eval_steps 100 \
19+
--save_steps 100 \
2020
--save_total_limit 5 \
2121
--logging_steps 5 \
2222
--max_length 2048 \
2323
--output_dir output \
24-
--system 'You are a helpful assistant.' \
2524
--warmup_ratio 0.05 \
26-
--dataloader_num_workers 4 \
27-
--model_author swift \
28-
--model_name swift-robot
25+
--dataloader_num_workers 4

swift/hub/hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import huggingface_hub
1010
from huggingface_hub import RepoUrl
1111
from huggingface_hub.hf_api import api, future_compatible
12-
from modelscope.utils.repo_utils import CommitInfo
1312
from requests.exceptions import HTTPError
1413
from transformers import trainer
1514
from transformers.utils import logging, strtobool
@@ -155,6 +154,7 @@ def upload_folder(
155154
ignore_patterns: Optional[Union[List[str], str]] = None,
156155
**kwargs,
157156
):
157+
from modelscope.utils.repo_utils import CommitInfo
158158
MSHub.push_to_hub(repo_id, folder_path, path_in_repo, commit_message, commit_description, token, True, revision,
159159
ignore_patterns)
160160
return CommitInfo(

swift/llm/template/template/deepseek.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ class DeepseekV2_5TemplateMeta(TemplateMeta):
128128
class DeepseekR1Template(Template):
129129

130130
def _encode(self, inputs: StdTemplateInputs) -> Dict[str, Any]:
131-
for message in inputs.messages:
132-
if message['role'] == 'assistant' and isinstance(message['content'], str):
133-
message['content'] = message['content'].split('</think>')[-1]
131+
if not self.is_training:
132+
for message in inputs.messages:
133+
if message['role'] == 'assistant' and isinstance(message['content'], str):
134+
message['content'] = message['content'].split('</think>')[-1]
134135
return super()._encode(inputs)
135136

136137

0 commit comments

Comments
 (0)