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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 常见问题整理
|
| 2 |
+
|
| 3 |
+
下面是swift使用过程中遇到的一些常见问题。
|
| 4 |
+
|
| 5 |
+
## 训练
|
| 6 |
+
|
| 7 |
+
### Q1: Swift微调支持的模型和数据集有哪些?
|
| 8 |
+
详见文档[支持的模型和数据集](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 9 |
+
|
| 10 |
+
### Q2: 使用自定义数据集训练时支持的数据格式有哪些?
|
| 11 |
+
自定义数据集格式见文档[自定义数据集](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 12 |
+
|
| 13 |
+
### Q3: 自定义数据集dataset_info.json格式,如何通过这种方式使用自定义数据集?
|
| 14 |
+
dataset_info.json格式见文档[自定义数据集](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。命令行,`--custom_dataset_info xxx.json`,`--dataset <dataset_id_or_path>`。
|
| 15 |
+
|
| 16 |
+
### Q4: 如何在界面训练使用自定义数据集?
|
| 17 |
+
界面训练使用自定义数据集与命令行一致,参考文档[自定义数据集](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 18 |
+
|
| 19 |
+
### Q5: 数据集jsonl文件里的一行能不能写成这样?{"index": "00000", "query": "11111", "response": "22222", 'source':'qqq'}
|
| 20 |
+
可以有额外字段的,这些字段不会被使用。
|
| 21 |
+
|
| 22 |
+
### Q6: 命令行参数在哪个文档中查看?
|
| 23 |
+
详见文档[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 24 |
+
|
| 25 |
+
### Q7: 离线环境训练需要配置的参数有哪些?
|
| 26 |
+
`--model 本地路径`,`--check_model false`,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 27 |
+
|
| 28 |
+
### Q8: model_type在哪儿查看?
|
| 29 |
+
查看文档[支持的模型和数据集](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 30 |
+
|
| 31 |
+
### Q9: 模型训练完能直接转gguf格式吗?
|
| 32 |
+
目前只支持导出ModelFile,详见文档[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 33 |
+
|
| 34 |
+
### Q10: swift支持预训练吗,我看只有sft?
|
| 35 |
+
支持,命令行`swift pt`,[预训练例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/pretrain),数据集格式见[自定义数据集](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 36 |
+
|
| 37 |
+
### Q11: 想问一下用lora微调的模型,如果想断点续训的话,是应该先把它合成一整个模型吗,还是可以不合起来,直接通过路径来指定原模型和lora块
|
| 38 |
+
不合并,`--resume_from_checkpoint output/xxx/vx-xxx/checkpoint-xxx`,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 39 |
+
|
| 40 |
+
### Q12: 我想控制一下从网上下载下来的原始模型权重的位置,怎么才能做到把原始的模型放在指定的文件夹里呢?
|
| 41 |
+
可以配置环境变量`MODELSCOPE_CACHE=your_path`将原始的模型存到指定路径;如果用sdk下载,通过`cache_dir="本地地址"`;也可以使用`modelscope download`命令行工具或`git`下载,详见modelscope文档[模型下载](https://modelscope.cn/docs/models/download)。训练时`--model`配置本地路径即可。如果需要在离线环境训练,配置`--check_model false`,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 42 |
+
|
| 43 |
+
### Q13: 有人在用ms-swift遇到过这个问题?
|
| 44 |
+
```text
|
| 45 |
+
[rank6]: pydantic_core._pydantic_core.ValidationError: 1 validation error for DeepSpeedZeroConfig
|
| 46 |
+
[rank6]: stage3_prefetch_bucket_size
|
| 47 |
+
[rank6]: Input should be a valid integer, got a number with a fractional part [type=int_from_float,input_value=11560550.4,in put_type=float]
|
| 48 |
+
[rank6]: For further information visit https://errors.pydantic.dev/2.8/v/int_fro_float
|
| 49 |
+
```
|
| 50 |
+
`deepspeed`版本降到`0.14.*`。
|
| 51 |
+
|
| 52 |
+
### Q14: 有微调qwen-2-vl的完整的教程和命令行吗?
|
| 53 |
+
参考多模态模型训练的[例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/multimodal)。
|
| 54 |
+
|
| 55 |
+
### Q15: 多模态大模型微调有什么支持的trick吗,类似llm的neftune?
|
| 56 |
+
`piassa/olora/dora`这些`lora`的变种或者`fourierft`都可以尝试。参考`sft`参数里面的各种trick,有一些不一定在多模态上适用。
|
| 57 |
+
|
| 58 |
+
### Q16: 训练过程中eval得到的acc和对应保存的ckpt去重新推理一遍计算得到的acc不是一致的
|
| 59 |
+
训练时候的eval_acc和推理时候的acc 计算方式不一样的。`acc_strategy`: 默认为`'token'`, 可选择的值包括: `'token'`, `'sentence'`.
|
| 60 |
+
|
| 61 |
+
### Q17: 魔搭官方镜像与swift环境
|
| 62 |
+
`docker run`命令启动容器即可,如:`docker run --gpus all -p 8000:8000 -it -d --name ms registry.cn-beijing.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-cuda12.1.0-py310-torch2.3.0-tf2.16.1-1.16.0 /bin/bash`,启动容器后拉最新代码安装swift。
|
| 63 |
+
|
| 64 |
+
### Q18: 多机多卡训练命令行
|
| 65 |
+
详见[多机多卡例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/multi-node)
|
| 66 |
+
|
| 67 |
+
### Q19: 如何选择template?
|
| 68 |
+
见[issue](https://github.com/modelscope/ms-swift/issues/1813)。
|
| 69 |
+
|
| 70 |
+
### Q20: 多卡训练torchrun和swift sft如何使用?
|
| 71 |
+
`swift sft`走的就是`torchrun`。
|
| 72 |
+
|
| 73 |
+
### Q21: 有个问题,因为我的sft数据集太大了,然后每次tokenize都需要很久,有解决方案吗?
|
| 74 |
+
使用`lazy_tokenize`,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 75 |
+
|
| 76 |
+
### Q22: 训练时,如果两个数据集直接追加一起放在训练集中,模型在训练的时候内部会有shuffle的流程吗?还是按顺序取数据去训练?
|
| 77 |
+
trainer中会随机。
|
| 78 |
+
|
| 79 |
+
### Q23: 如果模型两张卡,数据不开并行,deepspeed就会出现报错,怎么处理呢?
|
| 80 |
+
`deepspeed` 和 `device_map`是不兼容的,两个只能选1个。
|
| 81 |
+
|
| 82 |
+
### Q24: 在线训练时已经下载的数据集,离线重新训练为什么还要下载?
|
| 83 |
+
数据文件中有url,不支持离线训练。
|
| 84 |
+
|
| 85 |
+
### Q25: vlm模型训练如何减少显存使用?
|
| 86 |
+
配置`--freeze_vit true`。
|
| 87 |
+
|
| 88 |
+
### Q26: 为什么WEB-UI界面上支持的模型比文档中少?
|
| 89 |
+
升级一下ms-swift。
|
| 90 |
+
|
| 91 |
+
### Q27: 没有适配model_type的模型,sft时可以自定义special_tokens和chat_template吗?
|
| 92 |
+
可以。参考接入模型的PR以及自定义模型数据集文档。
|
| 93 |
+
|
| 94 |
+
### Q28: 可以在python脚本里面用DPO去训练qwen2-vl吗?
|
| 95 |
+
可以。从`swift.llm`中导入`rlhf_main` 和`RLHFArguments`。
|
| 96 |
+
|
| 97 |
+
### Q29: 请问训练MLLM时,可否先进行纯文本的预训练,然后接入VQA数据集进行微调呢?
|
| 98 |
+
可以。也可以混着训练。
|
| 99 |
+
|
| 100 |
+
### Q30: 基于qwen2的sft模型进行dpo训练,v100的机器,训练时都是Nan呢?
|
| 101 |
+
V100机器要用fp32训练qwen2。
|
| 102 |
+
|
| 103 |
+
### Q31: 想问一下,swift,能支持蒸馏吗?
|
| 104 |
+
参考这个[例子](https://github.com/modelscope/ms-swift/blob/main/examples/sampler/distill/distill.sh)
|
| 105 |
+
|
| 106 |
+
### Q32: cannot import name 'ftp_head' from 'datasets.utils.file_utils' ,有没有遇到这个问题的?
|
| 107 |
+
`pip install datasets==2.*`。
|
| 108 |
+
|
| 109 |
+
### Q33: 当前训练完默认最多保存两个checkpoint,如果想多保存几个应该怎么修改呢?
|
| 110 |
+
`--save_total_limit`,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 111 |
+
|
| 112 |
+
### Q34: Grounding任务中通用数据格式支持一个类别有多个实例吗?
|
| 113 |
+
目前均支持了一个物体对应多个bbox,参考文档[自定义数据集](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。
|
| 114 |
+
|
| 115 |
+
### Q35: 这个错误为什么会出现在这,numpy.object找不到在哪?
|
| 116 |
+
`numpy==1.26.3`,尝试一下。
|
| 117 |
+
|
| 118 |
+
### Q36: swift框架能支持序列并行了吗?
|
| 119 |
+
支持。现在是引入`xtuner`来实现。
|
| 120 |
+
|
| 121 |
+
### Q37: 用v100微调qwen2-1.5B时,loss': 0.0, 'acc': 0.0, 'grad_norm': nan,是什么问题呢?
|
| 122 |
+
尝试用fp32。
|
| 123 |
+
|
| 124 |
+
### Q38: gptq量化模型,能全参数微调吗?
|
| 125 |
+
不能。gptq模型的int型参数无法参与求导,只能附着lora等额外结构参与更新。
|
| 126 |
+
|
| 127 |
+
### Q39: 请问如果想用qlora的方式微调的话应该如何设置参数呢?glm4-chat
|
| 128 |
+
参考qlora[例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/qlora)。
|
| 129 |
+
|
| 130 |
+
### Q40: 用qwen2-vl-7b训练自己的数据集,总是出现"AdamW' object has no attribute 'train这个问题。
|
| 131 |
+
`accelerate 0.34.0`试试。
|
| 132 |
+
|
| 133 |
+
### Q41: 请教一个问题,我应该如何在swift框架下扩充我的词表呢?
|
| 134 |
+
swift目前还不支持词表扩充。
|
| 135 |
+
|
| 136 |
+
### Q42: 同名的模型是可以直接使用huggingface上的吗?
|
| 137 |
+
设置环境变量`USE_HF=1`。
|
| 138 |
+
|
| 139 |
+
### Q43: 请问Qwen2-VL-2B能进行增量预训练吗?有指导文件吗?有图文,也有纯文本的。
|
| 140 |
+
支持了,如果继续预训练将所有的内容放在response中就可以了。
|
| 141 |
+
|
| 142 |
+
### Q44: 请问下用视频做训练的时候,如何在参数中控制抽帧率,设了frame_rate设不起, minicpmv
|
| 143 |
+
设置环境变量`MAX_NUM_FRAMES`。
|
| 144 |
+
|
| 145 |
+
### Q45: swift在训练的时候,可以把验证集的推理结果保存下来吗?
|
| 146 |
+
训练结束后,运行swift infer,会保存。
|
| 147 |
+
|
| 148 |
+
### Q46: 我全量full参数dpo,为何保存的checkpoint 比原本模型文件要大呢?整整大了1倍
|
| 149 |
+
用V100微调,存的是fp32类型。
|
| 150 |
+
|
| 151 |
+
### Q47: 多机训练速度缓慢,在使用swift框架进行LLM训练时,发现采用deepspeed zero3训练会出现严重的速度下降问题
|
| 152 |
+
详见[issue](https://github.com/modelscope/ms-swift/issues/1825)。
|
| 153 |
+
|
| 154 |
+
### Q48: swift现在是支持qwen2-vl多阶段预训练的吗?我看官方的最佳实践里的sft好像都是vit+llm一起训的,不知道支不支持单独finetune
|
| 155 |
+
详见[issue](https://github.com/modelscope/ms-swift/issues/2222)。
|
| 156 |
+
|
| 157 |
+
### Q49: qwen2-vl是不是不支持混合纯文本数据?
|
| 158 |
+
支持图文和纯文本。
|
| 159 |
+
|
| 160 |
+
### Q50: 微调的时候可以绘制不同数据集的loss曲线吗?
|
| 161 |
+
不支持的,数据集是混合训练的。
|
| 162 |
+
|
| 163 |
+
### Q51: 模型训练后,回复重复了很多内容
|
| 164 |
+
参考[预训练与微调](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E9%A2%84%E8%AE%AD%E7%BB%83%E4%B8%8E%E5%BE%AE%E8%B0%83.html)。如果训练过程中出现重复的情况,请多训练几个epoch, 清洗数据, 全参数训练, 采用RLHF的方式缓解。
|
| 165 |
+
|
| 166 |
+
### Q52: 想问一下swift目前支持prompt tuning或者prefix tuning吗?
|
| 167 |
+
不支持,这两个方法知识遗忘比较严重,目前不推荐使用。
|
| 168 |
+
|
| 169 |
+
### Q53: 两张A10训练报错如下:
|
| 170 |
+
```text
|
| 171 |
+
[rank0]: torch.distributed.DistBackendError: NCCL error in:../torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:1970, unhandled system error (run with NCCL_DEBUG=INFO for details),NCCL version 2.20.5
|
| 172 |
+
[rank0]:ncclSystemError: System call (e.g. socket,malloc) or external library call failed or device error.
|
| 173 |
+
```
|
| 174 |
+
请检查共享内存是否太小,nccl需要共享内存。
|
| 175 |
+
|
| 176 |
+
### Q54: 请问在采用DDP微调训练的过程中,冻结某些层时导致的某些参数未参与梯度回传问题怎么解决?
|
| 177 |
+
配置参数`--ddp_find_unused_parameters true`。
|
| 178 |
+
|
| 179 |
+
### Q55: swift有没有数据集质检工具?
|
| 180 |
+
[data-juicer](https://github.com/modelscope/data-juicer)。
|
| 181 |
+
|
| 182 |
+
### Q56: web端在哪启动模型并行?只找到了数据并行的勾选项,没找到模型并行在哪。
|
| 183 |
+
指定可见显卡就可以。
|
| 184 |
+
|
| 185 |
+
### Q57: 如何不自动shuffle呢?想把它关掉。
|
| 186 |
+
目前只能改transformers[代码](https://github.com/huggingface/transformers/blob/main/src/transformers/trainer.py)。
|
| 187 |
+
|
| 188 |
+
### Q58: 'num_items_in_batch'是个什么参数?没找到在哪。
|
| 189 |
+
升级`ms-swift==2.5.2`或者降低`transformers<4.46`。
|
| 190 |
+
|
| 191 |
+
### Q59: 设置--dataset的话,怎么让数据集下载到固定位置,我在命令行参数没找到,下次如果再次读取的话如何可以从下载的地方读取
|
| 192 |
+
`dataset_path`支持文件夹,一般是`git clone`下载下来的数据集文件夹。详见[自定义数据集文档](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html#dataset-info-json)。
|
| 193 |
+
|
| 194 |
+
### Q60: --streaming true,我设置num_train_epochs会报错让我设置max_steps。不可以只设置num_train_epochs吗?
|
| 195 |
+
流式加载数据集一定需要设置`max_steps`。
|
| 196 |
+
|
| 197 |
+
### Q61: 好奇tools为啥是"[]",不是直接支持[]呢,能否帮忙解答一下,这个tools为啥是"[]"这种格式呢,不是直接使用[]呢,有些不理解
|
| 198 |
+
这是因为datasets的底层pyarrow对于类型管控比较严格。我们官方的grounding数据集的objects部分也是因为这个原因要用str,要不pyarrow就会报错:你每行的类型不一致。
|
| 199 |
+
|
| 200 |
+
### Q62: 这个参数不能用吗?check_dataset_strategy==discard
|
| 201 |
+
swift3.0没这个参数了,用`strict`参数。
|
| 202 |
+
|
| 203 |
+
### Q63: 运行sft命令出现报错如下:
|
| 204 |
+
```text
|
| 205 |
+
RuntimeError: Expected to mark a variable ready only once.This error is caused by one of the following reasons: 1) Use of a module parameter outsid forward function. Please make sure model parameters are not shared across multiple concurrent forward-backward passes. or try to use _set_static_graph( ) as round if this module graph does not change during training loop.2) Reused parameters in multiple reentrant backward passes. For example, if you use multiple oint` functions to wrap the same part of your model, it would result in the same set of parameters been used by different reentrant backward passes multiple and hence marking a variable ready multiple times. DDP does not support such use cases in default. You can try to use _set_static_graph( ) as a workaround if dule graph does not change over iterations.
|
| 206 |
+
```
|
| 207 |
+
加一下这个参数,`--gradient_checkpointing_kwargs '{"use_reentrant": false}'`。
|
| 208 |
+
|
| 209 |
+
### Q64: 有遇到过这个问题嘛?AttributeError:’TrainerState’ object has no attribute ’last_model_checkpoint’
|
| 210 |
+
数据集太少了,增加一些。数据数量不足一个step导致的报错。
|
| 211 |
+
|
| 212 |
+
### Q65: 我看到custompreprocessor里面可以定义preprocess,这个是在训练开始前全部会处理好,还是一边训练一边加载的啊
|
| 213 |
+
如果设置了参数`--streaming true`,就是一边训练一边加载。默认是全部处理完然后训练。
|
| 214 |
+
|
| 215 |
+
### Q66: 全参数训练internvl2_5,为啥里面的 freeze parameters默认就有vision_model 和 mlp1?我看命令行参数的文档里面freeze parameters默认为[],命令中显示设置 freeze vit, freeze aligner, freeze llm都为False,又会打印出来trainable parameters:[‘mlp1’] 也不知道是指只有mlp1可以train 还是 所有的paras都可以train 只是mlp1打印一下
|
| 216 |
+
先freeze parameters再active parameters。`freeze vit/freeze aligner/freeze llm`这三个参数会对freeze parameters 和trainable parameters进行调整.因为有些模型的`vit`中包含`aligner`,所以会将`aligner`单独加入trainable_parameters。
|
| 217 |
+
|
| 218 |
+
### Q67: 请问swift中的llamapro对多模态做适配了吗?
|
| 219 |
+
支持的。
|
| 220 |
+
|
| 221 |
+
### Q68: 我发现2.x支持MAX_PIXELS,3.x文档里有个--max_pixel参数是一个意思吗,他的处理逻辑是啥样的?我用12000*9000的图片,2.x设置resacle_image训练internvl还是会崩
|
| 222 |
+
环境变量的参数是对应模型的参数,`MAX_PIXELS`只支持qwen2vl的,internvl有自己的环境变量参数,详见[特定模型参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html#id18)。
|
| 223 |
+
|
| 224 |
+
### Q69: 从qwen base模型微调成chat模型有没有实践文档,有什么要特别配置的吗?
|
| 225 |
+
A: `swift sft`,没有其他需要特别配置的,参考[例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/base_to_chat)。
|
| 226 |
+
|
| 227 |
+
### Q70: sequence parallel例子在哪呀?
|
| 228 |
+
A: 看这个例子[sequence_parallel](https://github.com/modelscope/ms-swift/tree/main/examples/train/sequence_parallel)。
|
| 229 |
+
|
| 230 |
+
### Q71: swift能支持训练自己定义的模型结构吗?
|
| 231 |
+
可以的,只需要自定义`get_model_tokenizer_xxx`函数就好了,返回`model`和`tokenizer`。
|
| 232 |
+
|
| 233 |
+
### Q72: 我用"name_or_path": "/mnt/workspace/model/Qwen2.5-14B-Instruct"跑longlora 发现出现了报错,不会是只有个llama系列可以使用longlora吧
|
| 234 |
+
只有llama系列能用`longlora`。
|
| 235 |
+
|
| 236 |
+
### Q73: 想问下swift怎么加入自己的special token?
|
| 237 |
+
在`get_model_tokenizer`函数中增加。
|
| 238 |
+
|
| 239 |
+
### Q74: --freeze_parameters_ratio这个参数,如果设定为0.7,是不是说明训练的时候只更新llm的30%的参数?是随机更新30%吗,这个参数更新的机制是什么呀?
|
| 240 |
+
从下往上freeze。
|
| 241 |
+
|
| 242 |
+
### Q75: map过程为啥这么慢,这是正常的吗?
|
| 243 |
+
```text
|
| 244 |
+
Map: 4%|██ | 9000/203823 [02:18<50:34, 64.19 examples/s]
|
| 245 |
+
```
|
| 246 |
+
设置参数`--dataset_num_proc`可以开多进程。
|
| 247 |
+
|
| 248 |
+
### Q76: 请问数据集如何能够删除重新下载,感觉数据集出了点问题
|
| 249 |
+
设置参数`--download_mode`。
|
| 250 |
+
|
| 251 |
+
### Q77: 请问这个问题如何解决?safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge
|
| 252 |
+
磁盘空间不足了,模型没有保存完整。
|
| 253 |
+
|
| 254 |
+
### Q78: swift3.0不支持get_default_template_type是吗?
|
| 255 |
+
请查看`model.model_meta.template`,信息都存在`model.model_meta和model.model_info`。
|
| 256 |
+
|
| 257 |
+
### Q79: 魔搭swift微调支持herms格式的agent微调嘛,我看qwen2.5使用vllm原生支持hermes格式的工具调用,怎么swift上没有看到相关的
|
| 258 |
+
目前没有支持`hermes`格式,主要还是`toolbench`和`react`两个格式,因为`react`应用比较广泛一些,目前swift的deploy也支持解析这两种格式并给出`openai tool calling`的。
|
| 259 |
+
|
| 260 |
+
### Q80: 请问默认模型训练都是left padding是吧?
|
| 261 |
+
训练可以选择使用左padding还是右padding。默认是右padding, `batch infer`都是左padding。
|
| 262 |
+
|
| 263 |
+
### Q81: 请问下现在支持grounding任务了吗
|
| 264 |
+
examples下有[例子](https://github.com/modelscope/ms-swift/blob/main/examples/train/multimodal/grounding.sh)。
|
| 265 |
+
|
| 266 |
+
### Q82: 请问现在ms-swift支持对比学习,从而训练llm_emb吗?
|
| 267 |
+
支持,[例子](https://github.com/modelscope/ms-swift/blob/main/examples/train/embedding/train.sh)。
|
| 268 |
+
|
| 269 |
+
### Q83: 话说直接从peft和trl库,手搓微调和grpo代码和swift官方在同参数下进行训练,效果差异大吗?
|
| 270 |
+
区别不大,额外支持了多模态。
|
| 271 |
+
|
| 272 |
+
### Q84: swift 目前不支持 minicpmo2_6 使用音频模态输入的训练吗?会报错: assert media_type in {'image', 'video'}
|
| 273 |
+
目前不支持音频。
|
| 274 |
+
|
| 275 |
+
### Q85: swift可以微调deepseek R1 671B吗?
|
| 276 |
+
可以,template是接入了的,不过过程会比较麻烦,要先fp8转bf16。
|
| 277 |
+
|
| 278 |
+
### Q86: 最新的swift框架不是通过这个命令来指定模型的位置的么?这是我已经下载好的模型位置,不知道为什么还要下载,还下不下来,提示报错git clone
|
| 279 |
+
```shell
|
| 280 |
+
--model /mnt/workspace/.cache/modelscope/hub/deepseek-ai/deepseek-vl2/ \
|
| 281 |
+
```
|
| 282 |
+
有些需要clone repo,然后通过`local_repo_path`指定。
|
| 283 |
+
|
| 284 |
+
### Q87: swift现在支持多模态的grpo吗?
|
| 285 |
+
支持。
|
| 286 |
+
|
| 287 |
+
### Q88: grpo的reward函数支持自己定义么?
|
| 288 |
+
支持,参考[examples/train/grpo/plugin](https://github.com/modelscope/ms-swift/tree/main/examples/train/grpo/plugin)。
|
| 289 |
+
|
| 290 |
+
### Q89: 请问为什么 --torch_dtype float16 (卡不能使用bf16)会出现报错:lib/python3.12/site-packages/torch/amp/grad_scaler.py", line 260, in _unscale_grads_ raise ValueError("Attempting to unscale FP16 gradients.") ValueError: Attempting to unscale FP16 gradients.
|
| 291 |
+
全参数,不能fp16训练的。
|
| 292 |
+
|
| 293 |
+
### Q90: 请教一个问题。我用swift训练了一个reward模型(基线是qwen2.5-7b),然后用在ppo或者grpo中加载会报错。reward模型是lora训练的。
|
| 294 |
+
```shell
|
| 295 |
+
--rlhf_type ppo \
|
| 296 |
+
--model Qwen/Qwen2.5-14B-Instruct \
|
| 297 |
+
--reward_model /mnt/workspace/output/rm/model --train_type lora \
|
| 298 |
+
--dataset 'AI-ModelScope/alpaca-gpt4-data-zh#20000' --torch_dtype float32 --num_train_epochs 1 \
|
| 299 |
+
--per_device_train_batch_size 1 --per_device_eval_batch_size 1 --learning_rate 1e-5 --lora_rank 8 --lora_alpha 32 \
|
| 300 |
+
--target_modules all-linear \
|
| 301 |
+
--gradient_accumulation_steps 16 --eval_steps 100 --save_steps 100 \
|
| 302 |
+
```
|
| 303 |
+
lora训练的reward model需要merge一下。
|
| 304 |
+
|
| 305 |
+
### Q91: 各位大佬,请问要微调deepseek_vl2,transformers用什么什么版本?官方文档说<4.42,但是4.42及以下也报错。peft版本也要降低吗?
|
| 306 |
+
`peft==0.11.*`。
|
| 307 |
+
|
| 308 |
+
### Q92: 请问generate train split太慢了有没有什么好办法呀(大概有30多个数据集,总数据量百万左右)。之前swift 2.x好像没有这么慢。lazy tokenize 已经开了
|
| 309 |
+
设置`--dataset_num_proc 16`。
|
| 310 |
+
|
| 311 |
+
### Q93: 请问下微调qwen2.5vl的时候,我想使用全参数微调visual encoder同时使用LoRA微调LLM,怎么实现呢?
|
| 312 |
+
参考这里[例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/multimodal/lora_llm_full_vit)。
|
| 313 |
+
|
| 314 |
+
### Q94: 问一下,swift怎么使用自定义的损失函数?
|
| 315 |
+
plugin中加就可以了。
|
| 316 |
+
|
| 317 |
+
### Q95: 请问下MoE的参数有哪些,参数表里关键字搜索不到?专家数量,专家路由这些参数怎么设置?
|
| 318 |
+
直接用config.json中的参数
|
| 319 |
+
|
| 320 |
+
### Q96: grpo训练中使用lmdeploy会报相关函数不存在的问题,想请教下具体问题,在lmdeployengine类里面确实没找到load_weights这个函数
|
| 321 |
+
只在turbomind引擎下支持。
|
| 322 |
+
|
| 323 |
+
### Q97: Moonlight-16B-A3B-Instruct, 我在微调这个模型的时候报错怎么办?ms-swift好像不支持这个模型进行微调
|
| 324 |
+
因为是模型文件中禁止了训练, 参考deepseek_vl2的解决方案,你搜搜issue。
|
| 325 |
+
|
| 326 |
+
### Q98: 训练时出了这个错应该咋解决?RuntimeError: “triu_tril_cuda_template“ not implemented for ‘BFloat16'
|
| 327 |
+
```shell
|
| 328 |
+
CUDA_VISIBLE_DEVICES=01,2,3,4,5,6,7 \
|
| 329 |
+
swift sft \
|
| 330 |
+
--model Internlm3-8b \
|
| 331 |
+
--dataset train.json \
|
| 332 |
+
--train_type full \
|
| 333 |
+
--torch_dtype bfloat16 \
|
| 334 |
+
--num_train_epochs 5 \
|
| 335 |
+
--per_device_train_batch_size 1 \
|
| 336 |
+
--deepspeed zero3 \
|
| 337 |
+
--per_device_eval_batch_size 1 \
|
| 338 |
+
--learning_rate 1e-4 \
|
| 339 |
+
--gradient_accumulation_steps 16 \
|
| 340 |
+
--eval_steps 100 \
|
| 341 |
+
--save_steps 100 \
|
| 342 |
+
--save_total_limit 5 \
|
| 343 |
+
--logging_steps 5 \
|
| 344 |
+
--max_length 2048 \
|
| 345 |
+
--output_dir output \
|
| 346 |
+
--warmup_ratio 0.05 \
|
| 347 |
+
--dataloader_num_workers 4
|
| 348 |
+
```
|
| 349 |
+
升级torch。
|
| 350 |
+
|
| 351 |
+
### Q99: 支持自定义reward吗?
|
| 352 |
+
支持,看这里的[例子](https://github.com/modelscope/ms-swift/tree/main/examples/train/grpo/plugin)。
|
| 353 |
+
|
| 354 |
+
### Q100: grpo训练,loss和grad_norm全是0,正常的吗?
|
| 355 |
+
```text
|
| 356 |
+
{'loss': 0.0. 'grad norm':0.0, 'learning_rate':9e-08, 'memory(GiB)':88.1, 'train_speed(iter/s)':0.009252, 'completion_length': 150.00000763, 'response_clip ratio': 0.0, 'rewards/Format':1.0, 'reward
|
| 357 |
+
: 1.0, 'reward std':0.0, 'kl': 0.0, 'clip_ratio': 0.0, 'epoch': 0.0, 'qlobal step/max steps':'1/1052', 'percentage':'0.10% 'elapsed time': '36s 'remaining time': '10h 43m 54s'}
|
| 358 |
+
{'loss': 0.0,'grad_norm':0.0,'learning_rate': 1.8e-07,'memory(GiB)':94.15,'train_speed(iter/s)':0.014782,'completion_length': 133.25000763,'response_clip_ratio': 0.0,'rewards/Format': 1.0, 'rewa rd': 1.0,'reward_std': 0.0, 'kl': 0.0,'clip_ratio': 0.0,'epoch': 0.0, 'global_step/max_steps': '2/1052','percentage': '0.19%', 'elapsed_time': '1m 3s', 'remaining_time': '9h 19m 49s'}
|
| 359 |
+
{'loss': 0.0, 'qrad norm': 0.0, 'learning rate': 2.7e-07,'memory(GiB)': 94.15,'train_speed(iter/s)': 0.018695,'completion_length': 123.08333969,,'response_clip_ratio': 0.0,'rewards/Format': 1.0, 'rewa rd': 1.0, 'reward_ std': 0.0,'kl': 0.0,'clip_ratio': 0.0, 'epoch': 0.0, 'global_step/max_steps': '3/1052','percentage': '0.29%,'elapsed_time': '1m 29s','remaining_time': '8h 39m 34s'}
|
| 360 |
+
```
|
| 361 |
+
训练过程中loss接近0是正常情况,参考[issue](https://github.com/huggingface/open-r1/issues/239#issuecomment-2646297851)。
|
| 362 |
+
|
| 363 |
+
### Q101: 请教一下这个grpo的内置奖励函数,从哪里可以传入accuracy_orm
|
| 364 |
+
目前是直接改代码。
|
| 365 |
+
|
| 366 |
+
### Q102: 我看这奖励函数有solution参数,是要从数据集里面传过来吗?就是我数据集必须有solution这项?
|
| 367 |
+
是的,针对math问题,不然不好算accuracy。
|
| 368 |
+
|
| 369 |
+
### Q103: 训练为什么没有token_acc?
|
| 370 |
+
有些模型`logits`和`labels`数量对不上,就不算的。
|
| 371 |
+
|
| 372 |
+
### Q104: 微调Ovis2 使用lora参数不起作用?加不加--train_type lora \,好像都是全参数微调?显存没变化。
|
| 373 |
+
`--max_length`限制一下,这个模型有点特殊,需要padding到max_length。
|
| 374 |
+
|
| 375 |
+
### Q105: 请问下用qwen2.5跑一个分类任务,抱下面的错误,是哪里配置的有问题呢?ValueError: The model did not return a loss from the inputs, only the following keys: logits. For reference, the inputs it received are input_ids,attention_mask.
|
| 376 |
+
数据集是这样的:{"messages": [{"role": "user", "content": "xxxxx"}, {"label": 1}]}
|
| 377 |
+
`label`写在`message`同级。
|
| 378 |
+
|
| 379 |
+
### Q106: 有人知道这是哪错了吗?���练方法是vera
|
| 380 |
+
```text
|
| 381 |
+
KeyError("The 'metric_for_best_model' training argument is set to 'eval_loss', which is not found in the evaluati on metrics. The available evaluation metrics are:['eval_runtime', 'eval_samples_per_second', 'eval_steps_per_sec ond', 'epoch', 'global_step/max_steps', 'percentage', 'elapsed_time', 'remaining_time']. consider changing the 'metric_for_best_model' via the TrainingArguments.")
|
| 382 |
+
Train: 45%| 100/220[09:47<11:44,5.87s/it]
|
| 383 |
+
```
|
| 384 |
+
```shell
|
| 385 |
+
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
|
| 386 |
+
swift sft \
|
| 387 |
+
--model Qwen/Qwen2.5-7B-Instruct \
|
| 388 |
+
--dataset '/mnt/workspace/data.json' \
|
| 389 |
+
--train_type vera \
|
| 390 |
+
--torch_dtype bfloat16 \
|
| 391 |
+
--num_train_epochs 4 \
|
| 392 |
+
--per_device_train_batch_size 1 \
|
| 393 |
+
--learning_rate 1e-4 \
|
| 394 |
+
--gradient_accumulation_steps 16 \
|
| 395 |
+
--eval_steps 100 \
|
| 396 |
+
--save_steps 100 \
|
| 397 |
+
--save_total_limit 5 \
|
| 398 |
+
--logging_steps 5 \
|
| 399 |
+
--max_length 4096 \
|
| 400 |
+
--warmup_ratio 0.05 \
|
| 401 |
+
--output_dir output/Qwen2.5-7B-vera \
|
| 402 |
+
```
|
| 403 |
+
`--label_names labels`,加这个参数。
|
| 404 |
+
|
| 405 |
+
### Q107: 启动了VllmEngine,要如何退出呀?就是调用了engine,模型就被载入显存准备工作。但是我推理完想要engine释放显存。下次调用时,再加载。而不是一直占用
|
| 406 |
+
sleep mode啊,支持的。`engine.sleep(level=1)/engine.wake_up()`,构造的时候加一个`enable_sleep_mode=True`。
|
| 407 |
+
|
| 408 |
+
### Q108: 求问,streaming模式下,trainer_sampler_random是不是就没有作用了呢?
|
| 409 |
+
streaming是不随机的。
|
| 410 |
+
|
| 411 |
+
### Q109: 请问grpo使用vllm进行推理,vllm可以设置trust_rwmote_code吗?
|
| 412 |
+
默认就是true的。
|
| 413 |
+
|
| 414 |
+
### Q110: 请教一下,pretrain阶段数据集比较大,用了streaming流式和packing打包数据,这时候需要设置 max_steps,有没有参数或者命令可以根据epochs、bs等参数计算打包后的总的steps吗?
|
| 415 |
+
会按`epochs`和`max_steps`两者较小的结束训练。
|
| 416 |
+
|
| 417 |
+
### Q111: unsloth训练,报错:assert(type(target modules) in (list,tuple,))。配置的参数是--target modules all-linear
|
| 418 |
+
别用`all-linear`,改为具体的模块列表,比如`--target_modules q k v`。
|
| 419 |
+
|
| 420 |
+
### Q112: Swift现在支持多标签分类么?
|
| 421 |
+
支持的。自定义数据集文档有格式,然后在命令行参数文档中搜索一下`problem_type`,改一下,其他和回归是一样的。
|
| 422 |
+
|
| 423 |
+
### Q113: 请问packing中flash_attn是分开处理的还是合并处理的?
|
| 424 |
+
一定需要flash_attn,不然是有误差,attention_mask会出问题。
|
| 425 |
+
|
| 426 |
+
## 推理
|
| 427 |
+
|
| 428 |
+
### Q1:swift推理有文档吗?
|
| 429 |
+
swift支持python脚本、命令行、ui界面推理,详见[推理和部署](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%8E%A8%E7%90%86%E5%92%8C%E9%83%A8%E7%BD%B2.html)。
|
| 430 |
+
|
| 431 |
+
### Q2: 训练后的模型如何使用数据集推理?
|
| 432 |
+
参数`--load_data_args true`或`--val_dataset <your-val-dataset>`,见文档[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 433 |
+
|
| 434 |
+
### Q3: swift推理的时候可以指定下载好的模型吗?
|
| 435 |
+
`--model`配置本地路径即可,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 436 |
+
|
| 437 |
+
### Q4: 我想在一个没有label的数据集上推理,怎么做呢?我看文档里面的数据集格式都是训练集
|
| 438 |
+
配置参数`--val_dataset <your-val-dataset>`。
|
| 439 |
+
|
| 440 |
+
### Q5: 遇到报错ValueError: Input length of input_ids is 35, but `max_length` is set to 20.如何解决?
|
| 441 |
+
```text
|
| 442 |
+
raise ValueError(
|
| 443 |
+
ValueError: Input length of input_ids is 35, but `max_length` is set to 20. This can lead to unexpected behavior. You should consider increasing `max_length` or, better yet, setting `max_new_tokens`.
|
| 444 |
+
```
|
| 445 |
+
设置model.generation_config.max_new_tokens。
|
| 446 |
+
|
| 447 |
+
### Q6: qwen2-vl推理(训练)爆显存
|
| 448 |
+
设置命令行参数`--max_pixels xxx`、环境变量`MAX_PIXELS=xxx`、或特定模型参数`--model_kwargs '{"max_pixels": xxx}'`,其中环境变量仅对文档中对应的模型生效,详见文档[特定模型参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html#id18)。
|
| 449 |
+
|
| 450 |
+
### Q7: v100显卡,在python虚拟环境中,参考https://swift2x.readthedocs.io/zh-cn/latest/Multi-Modal/qwen2-vl%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.html 完成环境准备,在测试推理命令:CUDA_VISIBLE_DEVICES=0,1,2,3 swift infer --model_type qwen2-vl-7b-instruct 时报错:RuntimeError: probability tensor contains either `inf`, `nan` or element < 0
|
| 451 |
+
尝试用A10或者3090机器推理。
|
| 452 |
+
|
| 453 |
+
### Q8: 运行下面命令,预测之后的结果在哪里?CUDA_VISIBLE_DEVICES=0 swift infer --ckpt_dir output/glm4v-9b-chat/vx-xxx/checkpoint-xxx-merged --load_data_args true
|
| 454 |
+
日志中会打印路径。
|
| 455 |
+
|
| 456 |
+
### Q9: 现在最新的swift版本,infer命令能通过logprobs参数输出概率值吗?
|
| 457 |
+
可以输出logprobs,命令行推理设置`--logprobs true`,python脚本推理设置`request_config = RequestConfig(..., logprobs=True, top_logprobs=2)`,参考[test_logprobs.py](https://github.com/modelscope/ms-swift/blob/main/tests/infer/test_logprobs.py)。
|
| 458 |
+
|
| 459 |
+
### Q10: 最新版本swift,我在加载qwen2-32b-instruct-awq 量化模型及其lora的时候,使用vllm 提示我加上merge lore true,我加上就报错了,我去掉vllm 加速就能正常推理了,但是速度很慢
|
| 460 |
+
qlora训练的模型不支持merge-lora的, 建议lora微调后 merge-lora再量化。
|
| 461 |
+
|
| 462 |
+
### Q11: vllm会报错,assert factor in rope_scaling
|
| 463 |
+
详见qwen2-vl [issue#96](https://github.com/QwenLM/Qwen2-VL/issues/96)。
|
| 464 |
+
|
| 465 |
+
### Q12: vllm作为推理后端的话,模型必须合并以后才能调用吗?
|
| 466 |
+
可以不合并,详见文档[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)。
|
| 467 |
+
|
| 468 |
+
### Q13: 请问在使用python脚本推理时,如何使用cpu?
|
| 469 |
+
设置环境变量,`os.environ['CUDA_VISIBLE_DEVICES'] = '-1'`。
|
| 470 |
+
|
| 471 |
+
### Q14: 有人遇到过这个问题吗?RuntimeError: "triu_tril_cuda_template" not implemented for'BFloat16'
|
| 472 |
+
升级torch,这个版本的torch没实现这个算子。
|
| 473 |
+
|
| 474 |
+
### Q15: qwen2-audio支持流式推理吗?
|
| 475 |
+
支持,详见[issue](https://github.com/modelscope/ms-swift/issues/1653)
|
| 476 |
+
|
| 477 |
+
### Q16: inference client推理多模态,do_sample在哪里设置?
|
| 478 |
+
设置temperature=0。
|
| 479 |
+
|
| 480 |
+
### Q17: ms-swift支持大模型批处理不?
|
| 481 |
+
支持的。详见[demo](https://github.com/modelscope/ms-swift/blob/main/examples/infer/demo.py)。
|
| 482 |
+
|
| 483 |
+
### Q18: ms-swift量化模型的时候,显示内存不足,可以在量化的时候少占用一些资源吗,慢一点没关系。
|
| 484 |
+
尝试设置`--device_map cpu`。
|
| 485 |
+
|
| 486 |
+
### Q19: swift支持对多模态模型量化吗?
|
| 487 |
+
支持。
|
| 488 |
+
|
| 489 |
+
### Q20: 使用GPTQ报错如下,请问是啥原因?
|
| 490 |
+
```text
|
| 491 |
+
if llm_config['architectures'][0] == 'LlamaForCausalLM':
|
| 492 |
+
KeyError: 'architectures'
|
| 493 |
+
```
|
| 494 |
+
尝试transformers==4.44.*版本。
|
| 495 |
+
|
| 496 |
+
### Q21: swift infer如何将评估的结果保存到指定文件呢 每次都不知道保存到哪里了
|
| 497 |
+
设置`--result_path your_path`,详见[InferArguments](https://github.com/modelscope/ms-swift/blob/main/swift/llm/argument/infer_args.py)。
|
| 498 |
+
|
| 499 |
+
### Q22: AWQ量化yi-vl-6b出错如下:
|
| 500 |
+
```text
|
| 501 |
+
TypeError: swift.llm.utils.model.get_model_tokenizer_with_flash_attn() got multiple values for keyword argument 'automodel_class'.
|
| 502 |
+
```
|
| 503 |
+
请使用gptq量化。
|
| 504 |
+
|
| 505 |
+
### Q23: 想问一下用swift export对qwen2.5 72B模型进行gptq int4量化,max model length=32768用的是默认值,给的校准数据集有128个样本,但是量化的时候报错了,报错日志是:factorization could not be completed because the input is not positive-definite(the leading minor of order 18145 is not pisitive-definite)。是什么原因?
|
| 506 |
+
海森矩阵不正定的问题,试试其他的数据集。
|
| 507 |
+
|
| 508 |
+
### Q24: 请问批量推理是只能自己编写代码运行吗?不可以按照 sft 那样填脚本参数码
|
| 509 |
+
可以,`swift infer --val_dataset xxx --max_batch_size 16 ... `
|
| 510 |
+
|
| 511 |
+
### Q25: 问一下,swift app推理时,temperature默认是多少的?
|
| 512 |
+
默认从generation_config.json中读取。
|
| 513 |
+
|
| 514 |
+
### Q26: 请问,导出和量化的时候可以多卡吗?
|
| 515 |
+
加载模型可以多卡,量化是单卡。
|
| 516 |
+
|
| 517 |
+
### Q27: swift export的时候传入自定义的template_type,是不是就可以永久改掉template_type了?如果swift export --template_type 自定义,是不是就可以把模型对应的template改掉
|
| 518 |
+
不会被修改,swift中的template是定义在swift内部的,不是以jinja方式保存的。
|
| 519 |
+
|
| 520 |
+
### Q28: awq量化Qwen2VL报错:TypeError: Qwen2VLForConditionalGeneration.__init__() got an unexpected keyword argument 'use_cache'
|
| 521 |
+
用`gptq`量化。
|
| 522 |
+
|
| 523 |
+
### Q29: ddp 推理,infer里面的这个max_batch_size,是指每张卡的batch_size还是总的batch_size
|
| 524 |
+
每张卡。
|
| 525 |
+
|
| 526 |
+
### Q30: 请问swift.inference现在支持messages格式的输入吗?现在看到好像只能用query格式,得到response。数据answer里面已经包含了部分prompt,希望补全answer,应该怎么修改inference
|
| 527 |
+
```text
|
| 528 |
+
{"messages": [{"role": "system", "content": "<system>"}, {"role": "user", "content": "<query1>"}, {"role": "assistant", "content": "answer1, "}]}
|
| 529 |
+
```
|
| 530 |
+
用swift3是可以的,参考[examples/infer/demo_agent](https://github.com/modelscope/ms-swift/blob/main/examples/infer/demo_agent.py)。
|
| 531 |
+
|
| 532 |
+
### Q31: 请问swift infer的时候,如何让结果实时写入result_path,而不是最后一次性写入呢?
|
| 533 |
+
```shell
|
| 534 |
+
swift infer \
|
| 535 |
+
--ckpt_dir model_dir \
|
| 536 |
+
--streaming true \
|
| 537 |
+
--val_dataset dataset.jsonl \
|
| 538 |
+
--result_path result.jsonl
|
| 539 |
+
```
|
| 540 |
+
`--stream true`,这样可以一条条写,不过是非batch推理的。
|
| 541 |
+
|
| 542 |
+
### Q32: 我在swift训练推理的时候是有效果的,但是用merge_lora后再通过ollama的api开接口的时候效果就没了
|
| 543 |
+
试试transformers加载,swift的template是对齐transformers的。
|
| 544 |
+
|
| 545 |
+
### Q33: 模型推理的时候如果需要在特定前缀下继续推理的话是设置哪个参数?
|
| 546 |
+
参数`--response_prefix`。
|
| 547 |
+
|
| 548 |
+
### Q34: 一直报这个错怎么改呀?
|
| 549 |
+
```text
|
| 550 |
+
File "/mnt/workspace/swift/swift/1lm/dataset/preprocessor/core. py", line 69, in _check_messages raise
|
| 551 |
+
ValueError(f'assistant_message; {assistant_message}')
|
| 552 |
+
ValueError: assistant_message: {'role' :'assistant', 'content': ''}
|
| 553 |
+
```
|
| 554 |
+
```shell
|
| 555 |
+
CUDA_VISIBLE_DEVICES=0 NPROC_PER_NODE=1 MAX_PIXELS=1003520 swift sft --model Qwen/Qwen2.5-VL-7B-Instruct --train_type lora --dataset /mnt/workspace/data.json --deepspeed zero2 --max_length 16384
|
| 556 |
+
```
|
| 557 |
+
数据集assistant字段为空,如果是推理,把这个空字符串删掉,因为这个会导致训练时nan,会做检查。
|
| 558 |
+
|
| 559 |
+
## 部署
|
| 560 |
+
|
| 561 |
+
### Q1: 如何部署训练后的模型?
|
| 562 |
+
`swift deploy --adapters xxx`,见文档[推理和部署](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%8E%A8%E7%90%86%E5%92%8C%E9%83%A8%E7%BD%B2.html)。
|
| 563 |
+
|
| 564 |
+
### Q2: 如何使用vllm部署进行多卡部署?
|
| 565 |
+
详见[例子](https://github.com/modelscope/ms-swift/tree/main/examples/deploy)。
|
| 566 |
+
|
| 567 |
+
### Q3: 请问用vllm部署的时候,客户端怎么传入图片?
|
| 568 |
+
详见[客户端例子](https://github.com/modelscope/ms-swift/tree/main/examples/deploy/client/mllm)。
|
| 569 |
+
|
| 570 |
+
### Q4: 有个问题想问一下,qwen2-7b部署后使用客户端时,调用openai的api要使用client.completions.create,不能使用client.chat.completions.create,但是使用qwen2-7b-instruct-q5_k_m.gguf的时候可以使用client.chat.completions.create,这是为什么呀?
|
| 571 |
+
base模型可以用client.chat.completions.create的,不过这个是兼容行为。
|
| 572 |
+
|
| 573 |
+
### Q5: 使用两张卡用swift deploy启动服务端后,用Ctrl+C退出后,会一直有一个python进程,一直占用一张卡的显存,这是正常现象吗?
|
| 574 |
+
需要kill 一下, 这是vllm的问题。
|
| 575 |
+
|
| 576 |
+
### Q6: 在哪查看模型是否支持lmdeploy或vllm加速?
|
| 577 |
+
vllm和lmdeploy分别有自己的模型支持范围,请查看各自官方文档来确定是否可用。
|
| 578 |
+
|
| 579 |
+
### Q7: 通义千问2.5-数学-7B-Instruct,会偶尔这样一直返回乱码,是什么问题呢?用vllm部署,fp16。
|
| 580 |
+
尝试bf16。
|
| 581 |
+
|
| 582 |
+
### Q8: swift推理服务启动后,交互进行设置的温度之类的配置,如何设置呢?
|
| 583 |
+
推理只能启动前设置。部署可以在启动时设置默认,之后在客户端继续设置,覆盖默认。
|
| 584 |
+
|
| 585 |
+
### Q9: 在本地部署qwen2vl模型,推理后端使用vllm,本地视频怎么传入呢?可以使用 base64 传进去吗?curl调用如何加载视频呢?
|
| 586 |
+
base64,详见[mllm客户端例子](https://github.com/modelscope/ms-swift/tree/main/examples/deploy/client/mllm)
|
| 587 |
+
|
| 588 |
+
### Q10: qwen2-vl部署时报错如下,是vllm的版本不对么?
|
| 589 |
+
```text
|
| 590 |
+
Unrecognized keys in `rope_scaling`for 'rope_type'='default': {'mrope_section'} Unrecognized keys in `rope_scaling`for 'rope_type'='default': {'mrope_section'}
|
| 591 |
+
```
|
| 592 |
+
详见[issue](https://github.com/QwenLM/Qwen2-VL/issues/209)。
|
| 593 |
+
|
| 594 |
+
### Q11: 我用swift deploy做推理的时候,想让他输出token的概率,我加了logprobs True,但是它输出null,这个是什么原因呢?
|
| 595 |
+
```shell
|
| 596 |
+
RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=1 nohup swift deploy --ckpt_dir /mnt/workspace/checkpoint_600 --infer_backend vllm --logprobs True --load_data_args false --host 0.0.0.0 --port 8000 &
|
| 597 |
+
```
|
| 598 |
+
需要客户端传参数,`request_config = RequestConfig(..., logprobs=True, top_logprobs=2)`。
|
| 599 |
+
|
| 600 |
+
### Q12: wift3.0 部署推理,可以设置请求的超时时间么?如果图片url非法,会等在那里
|
| 601 |
+
设置环境变量`TIMEOUT`,默认是300秒。或者`InferClient`中可以传参数。
|
| 602 |
+
|
| 603 |
+
### Q13: swift部署的模型怎么没法流式生成啊?服务端的stream设为True了,客户端的stream也设为True了,但它就是没法流式生成
|
| 604 |
+
客户端控制的,查看[examples/deploy/client](https://github.com/modelscope/ms-swift/tree/main/examples/deploy/client)。
|
| 605 |
+
|
| 606 |
+
### Q14: swift部署好多模态模型之后,客户端传PIL.Image,有示例没?
|
| 607 |
+
看这个[client例子](https://github.com/modelscope/ms-swift/blob/main/examples/deploy/client/mllm/openai_client.py)。
|
| 608 |
+
|
| 609 |
+
### Q15: 请问 deploy部署时候,设置什么参数可以实现一次输出,输出多个结果呢?
|
| 610 |
+
`RequestConfig`参数`n`。
|
| 611 |
+
|
| 612 |
+
## 评测
|
| 613 |
+
|
| 614 |
+
### Q1: swift支持的评测集有哪些?
|
| 615 |
+
纯文本评测:
|
| 616 |
+
```text
|
| 617 |
+
'obqa', 'cmb', 'AX_b', 'siqa', 'nq', 'mbpp', 'winogrande', 'mmlu', 'BoolQ', 'cluewsc', 'ocnli', 'lambada',
|
| 618 |
+
'CMRC', 'ceval', 'csl', 'cmnli', 'bbh', 'ReCoRD', 'math', 'humaneval', 'eprstmt', 'WSC', 'storycloze',
|
| 619 |
+
'MultiRC', 'RTE', 'chid', 'gsm8k', 'AX_g', 'bustm', 'afqmc', 'piqa', 'lcsts', 'strategyqa', 'Xsum', 'agieval',
|
| 620 |
+
'ocnli_fc', 'C3', 'tnews', 'race', 'triviaqa', 'CB', 'WiC', 'hellaswag', 'summedits', 'GaokaoBench',
|
| 621 |
+
'ARC_e', 'COPA', 'ARC_c', 'DRCD'
|
| 622 |
+
```
|
| 623 |
+
|
| 624 |
+
多模态评测:
|
| 625 |
+
```text
|
| 626 |
+
'COCO_VAL', 'MME', 'HallusionBench', 'POPE', 'MMBench_DEV_EN', 'MMBench_TEST_EN', 'MMBench_DEV_CN', 'MMBench_TEST_CN',
|
| 627 |
+
'MMBench', 'MMBench_CN', 'MMBench_DEV_EN_V11', 'MMBench_TEST_EN_V11', 'MMBench_DEV_CN_V11',
|
| 628 |
+
'MMBench_TEST_CN_V11', 'MMBench_V11', 'MMBench_CN_V11', 'SEEDBench_IMG', 'SEEDBench2',
|
| 629 |
+
'SEEDBench2_Plus', 'ScienceQA_VAL', 'ScienceQA_TEST', 'MMT-Bench_ALL_MI', 'MMT-Bench_ALL',
|
| 630 |
+
'MMT-Bench_VAL_MI', 'MMT-Bench_VAL', 'AesBench_VAL', 'AesBench_TEST', 'CCBench', 'AI2D_TEST', 'MMStar',
|
| 631 |
+
'RealWorldQA', 'MLLMGuard_DS', 'BLINK', 'OCRVQA_TEST', 'OCRVQA_TESTCORE', 'TextVQA_VAL', 'DocVQA_VAL',
|
| 632 |
+
'DocVQA_TEST', 'InfoVQA_VAL', 'InfoVQA_TEST', 'ChartQA_TEST', 'MathVision', 'MathVision_MINI',
|
| 633 |
+
'MMMU_DEV_VAL', 'MMMU_TEST', 'OCRBench', 'MathVista_MINI', 'LLaVABench', 'MMVet', 'MTVQA_TEST',
|
| 634 |
+
'MMLongBench_DOC', 'VCR_EN_EASY_500', 'VCR_EN_EASY_100', 'VCR_EN_EASY_ALL', 'VCR_EN_HARD_500',
|
| 635 |
+
'VCR_EN_HARD_100', 'VCR_EN_HARD_ALL', 'VCR_ZH_EASY_500', 'VCR_ZH_EASY_100', 'VCR_ZH_EASY_ALL',
|
| 636 |
+
'VCR_ZH_HARD_500', 'VCR_ZH_HARD_100', 'VCR_ZH_HARD_ALL', 'MMDU', 'MMBench-Video', 'Video-MME'
|
| 637 |
+
```
|
| 638 |
+
|
| 639 |
+
详见文档[评测](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%AF%84%E6%B5%8B.html)。
|
| 640 |
+
|
| 641 |
+
### Q2: 如何使用自定义评测集?
|
| 642 |
+
纯文本、多模态自定义评测集必须和某个官方评测集数据格式(pattern)保持一致,见文档[评测](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%AF%84%E6%B5%8B.html)。
|
| 643 |
+
|
| 644 |
+
### Q3: python3.11环境,评测时mmengine报错
|
| 645 |
+
尝试python3.10环境。或先安装全量依赖: `pip3 install evalscope[all]`,再打patch: `pip3 install https://modelscope-open.oss-cn-hangzhou.aliyuncs.com/package/evalscope-0.5.3.post1-py3-none-any.whl`。
|
| 646 |
+
|
| 647 |
+
### Q4: 官方支持的评测数据集手动下载后,swift eval能配置本地路径评测吗?
|
| 648 |
+
先下载评测数据集[eval.zip](https://modelscope.cn/datasets/swift/evalscope_resource/files),解压后将里面的内容放到 `~/.cache/modelscope/media_resources/evalscope/data`文件夹下;再执行swift eval命令就可以使用本地数据。
|
| 649 |
+
|
| 650 |
+
### Q5: 自定义评测是不是有bug,把标准例子改成英文,一直都跑不通?
|
| 651 |
+
```shell
|
| 652 |
+
swift eval --model_type 'qwen2_5-1_5b-instruct' --eval_dataset no --custom_eval_config '/mnt/workspace/test_data/config_eval.json'
|
| 653 |
+
```
|
| 654 |
+
这是依赖了nltk的包,然后nltk的tokenizer需要下载一个punkt_tab的zip文件,国内有些环境下载不太稳定或者直接失败。已尝试改了代码做兜底,规避这个问题;参考[issue](https://github.com/nltk/nltk/issues/3293)。
|
| 655 |
+
|
| 656 |
+
### Q6: eval微调后的模型,总是会在固定的百分比停掉,但是vllm服务看着一直是有在正常运行的。模型越大,断开的越早。
|
| 657 |
+
`TIMEOUT`环境变量设置为-1。
|
| 658 |
+
|
| 659 |
+
### Q7: evalscope 支持多模型对比吗?
|
| 660 |
+
详见[文档](https://evalscope.readthedocs.io/zh-cn/latest/user_guides/arena.html)。
|
| 661 |
+
|
| 662 |
+
### Q8: 多模态数据集有没有自定义评估?
|
| 663 |
+
多模态自定义评估可以参考[文档](https://evalscope.readthedocs.io/zh-cn/latest/advanced_guides/custom_dataset/index.html)。
|
| 664 |
+
|
| 665 |
+
### Q9: ms-swift有方法测试qps,延迟,tokens/s吗?
|
| 666 |
+
可以尝试使用evalscope的[模型推理性能压测](https://evalscope.readthedocs.io/zh-cn/latest/user_guides/stress_test/index.html)。
|
| 667 |
+
|
| 668 |
+
### Q10: 评估的时候可不可以控制数据集条数?评估一个mmlu需要一个多小时,也太慢了。
|
| 669 |
+
配置参数`--eval_limit`,这里的`--eval_limit`是控制了每个subset的条数,比如mmlu有50多个subset,每个limit10条,那就是500多条。
|
| 670 |
+
|
| 671 |
+
### Q11: 想请问一下,评测时不是相当于让模型输出一次回答然后检查答案对不对吗,有没有办法可以记录或看到每次完整的回答呢?
|
| 672 |
+
ceval这种多选题的评测是通过计算每个选项的logits来得到的,没有输出回答内容;想得到回答内容的话,可以部署模型服务指定api url来评测,这样是通过解析模型输出来评测的,详见[文档](https://evalscope.readthedocs.io/zh-cn/latest/get_started/basic_usage.html#api),后面这两种可以做成可选项。
|
| 673 |
+
|
| 674 |
+
### Q12: 我想用evalscope压测一下我的模型,想采用prompt.txt文件的形式,这个文件内容的格式应该是什么样子的呀?
|
| 675 |
+
配置line_by_line,详见[文档](https://evalscope.readthedocs.io/zh-cn/latest/user_guides/stress_test/parameters.html#id5)。
|
| 676 |
+
|
| 677 |
+
### Q13: 使用evalscope perf进行模型推理性能压测,parallel和number这两个参数怎样使用呢?
|
| 678 |
+
number是请求的总数量,parallel是并发数量。
|
| 679 |
+
|
| 680 |
+
### Q14: 问一下评估swift eval里,模型最多生成1024token就结束了,这个如何修改?设置--max_new_tokens 5000,看起来没起作用
|
| 681 |
+
swift里面这个参数还没透出,可以使用evalscope来运行,model里面配置max_tokens参考[文档](https://evalscope.readthedocs.io/zh-cn/latest/user_guides/backend/vlmevalkit_backend.html#id6)。
|
| 682 |
+
|
| 683 |
+
### Q15: 请问evalscope现在支持deepseek-r1 的相关benchmark吗?AIME、MATH-500这样
|
| 684 |
+
支持的,这里有[最佳实践](https://evalscope.readthedocs.io/zh-cn/latest/best_practice/deepseek_r1_distill.html)。
|
| 685 |
+
|
| 686 |
+
### Q16: 想问一下evalscope测评gpqa使用本地路径报错: ValueError: BuildingConfig 'gpqa_extended' not found. Available: ['default']
|
| 687 |
+
参数配置如下:
|
| 688 |
+
```shell
|
| 689 |
+
--datasets gpqa --dataset-args '{"gpqa": {"local_path": "/mnt/workspace/gpqa"} }'
|
| 690 |
+
```
|
| 691 |
+
数据集如果要下载到本地使用,建议从modelscope上克隆仓库再指定路径。
|
| 692 |
+
|
| 693 |
+
### Q17: 用evalscope评测arc数据集的时候,报这个错误,这是什么原因呢,用的是加载本地数据路径方式
|
| 694 |
+
```text
|
| 695 |
+
KeyError: 'RequestId'
|
| 696 |
+
```
|
| 697 |
+
```shell
|
| 698 |
+
--datasets arc --dataset-args '{"arc": {"local_path": "/mnt/workspace/arc"}}'
|
| 699 |
+
```
|
| 700 |
+
参考[文档](https://evalscope.readthedocs.io/zh-cn/latest/get_started/basic_usage.html#id10),arc数据集本身需要通过py脚本来下载数据,直接clone仓库不行。
|
| 701 |
+
|
| 702 |
+
### Q18: 请教一下,想使用opencompass的后端评测,如何从本地加载下载好的数据集?
|
| 703 |
+
opencompass后端不支持设置`data_args`。
|
| 704 |
+
|
| 705 |
+
### Q19: swift eval 来评估模型,--eval_backend OpenCompass不支持自定义数据集吗?
|
| 706 |
+
```text
|
| 707 |
+
ValueError: eval_dataset: /mnt/workspace/data.jsonl is not supported.
|
| 708 |
+
eval_backend: OpenCompass supported datasets: ['C3', 'summedits', 'WiC', 'csl', 'lambada', 'mbpp', 'hellaswag', 'ARC_e', 'math', 'nq', 'race', 'MultiRC', 'cmb', 'ceval', 'GaokaoBench', 'mmlu', 'winogrande', 'tnews', 'triviaqa', 'CB', 'cluewsc', 'humaneval', 'AX_g', 'DRCD', 'RTE', 'ocnli_fc', 'gsm8k', 'obqa', 'ReCoRD', 'Xsum', 'ocnli', 'WSC', 'siqa', 'agieval', 'piqa', 'cmnli', 'cmmlu', 'eprstmt', 'storycloze', 'AX_b', 'afqmc', 'strategyqa', 'bustm', 'BoolQ', 'COPA', 'ARC_c', 'PMMEval', 'chid', 'CMRC', 'lcsts']
|
| 709 |
+
```
|
| 710 |
+
opencompass不支持自定义数据集,用native可以自定义模式。
|
| 711 |
+
|
| 712 |
+
### Q20: 我在本地用单张A100运行模型来做evalscope官方文档里的RAGAS评测任务(https://evalscope.readthedocs.io/zh-cn/latest/user_guides/backend/rageval_backend/ragas.html)时,跑文档中的两个样例花费了10分钟的时间,请问这是正常的么?有没有什么办法可以优化运行速度。
|
| 713 |
+
rag评测本身确实比较耗资源,使用本地critic llm确实会慢一些,处理不了batch请求,建议用vllm这样的框架来拉起任务。
|