Skip to content

Commit 6cf39bc

Browse files
committed
Merge commit '08d9ef4f04970e934ce375394205703214ede606' into release/2.4
* commit '08d9ef4f04970e934ce375394205703214ede606': fix rlhf & zero3 (#2034) Fix olora and pissa saving files which will cause the second saving failed (#2032) fix deploy eval kill (#2029) update code (#2028) refactor rlhf (#1975) Florence use post_encode & template support encoder-decoder (#2019) Add FAQ Document (#2013) fix lmdeploy qwen_vl (#2009) Support llava1.6-llama3.1-8b-instruct (#2005) Fix rlhf ref model (#2003) compat lmdeploy==0.6 (#2001) fix EngineGenerationConfig importError of lmdeploy (#1990) Support Deepseek 2.5 (#1992) fix eval is_multimodal (#1995) fix patch (#1997) fix model_mapping (#1982)
2 parents 7545374 + 08d9ef4 commit 6cf39bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1660
-2790
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
- [Citation](#-citation)
3737

3838
## 📝 Introduction
39-
SWIFT supports training(PreTraining/Fine-tuning/RLHF), inference, evaluation and deployment of **300+ LLMs and 50+ MLLMs** (multimodal large models). Developers can directly apply our framework to their own research and production environments to realize the complete workflow from model training and evaluation to application. In addition to supporting the lightweight training solutions provided by [PEFT](https://github.com/huggingface/peft), we also provide a complete **Adapters library** to support the latest training techniques such as NEFTune, LoRA+, LLaMA-PRO, etc. This adapter library can be used directly in your own custom workflow without our training scripts.
39+
SWIFT supports training(PreTraining/Fine-tuning/RLHF), inference, evaluation and deployment of **300+ LLMs and 80+ MLLMs** (multimodal large models). Developers can directly apply our framework to their own research and production environments to realize the complete workflow from model training and evaluation to application. In addition to supporting the lightweight training solutions provided by [PEFT](https://github.com/huggingface/peft), we also provide a complete **Adapters library** to support the latest training techniques such as NEFTune, LoRA+, LLaMA-PRO, etc. This adapter library can be used directly in your own custom workflow without our training scripts.
4040

4141
To facilitate use by users unfamiliar with deep learning, we provide a Gradio web-ui for controlling training and inference, as well as accompanying deep learning courses and best practices for beginners. SWIFT web-ui is available both on [Huggingface space](https://huggingface.co/spaces/tastelikefeet/swift) and [ModelScope studio](https://www.modelscope.cn/studios/iic/Scalable-lightWeight-Infrastructure-for-Fine-Tuning/summary), please feel free to try!
4242

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
- [引用](#-引用)
3838

3939
## 📝 简介
40-
SWIFT支持**300+ LLM和50+ MLLM**(多模态大模型)的训练(预训练、微调、对齐)、推理、评测和部署。开发者可以直接将我们的框架应用到自己的Research和生产环境中,实现模型训练评测到应用的完整链路。我们除支持了[PEFT](https://github.com/huggingface/peft)提供的轻量训练方案外,也提供了一个完整的**Adapters库**以支持最新的训练技术,如NEFTune、LoRA+、LLaMA-PRO等,这个适配器库可以脱离训练脚本直接使用在自己的自定流程中。
40+
SWIFT支持**300+ LLM和80+ MLLM**(多模态大模型)的训练(预训练、微调、对齐)、推理、评测和部署。开发者可以直接将我们的框架应用到自己的Research和生产环境中,实现模型训练评测到应用的完整链路。我们除支持了[PEFT](https://github.com/huggingface/peft)提供的轻量训练方案外,也提供了一个完整的**Adapters库**以支持最新的训练技术,如NEFTune、LoRA+、LLaMA-PRO等,这个适配器库可以脱离训练脚本直接使用在自己的自定流程中。
4141

4242
为方便不熟悉深度学习的用户使用,我们提供了一个Gradio的web-ui用于控制训练和推理,并提供了配套的深度学习课程和最佳实践供新手入门。 可以在[Huggingface space](https://huggingface.co/spaces/tastelikefeet/swift)[ModelScope创空间](https://www.modelscope.cn/studios/iic/Scalable-lightWeight-Infrastructure-for-Fine-Tuning/summary) 中体验SWIFT web-ui功能了。
4343

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# LLM&VLM训练、推理、部署、评测常见问题
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+
llm自定义数据集格式见文档[自定义与拓展](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.html);vlm自定义数据集格式,不同模型对图像数量的支持不同, 具体参考模型对应的最佳实践文档[Multi-Modal文档](https://swift.readthedocs.io/zh-cn/latest/Multi-Modal/index.html)
12+
13+
### Q3: 自定义数据集dataset_info.json格式,如何通过这种方式使用自定义数据集?
14+
dataset_info.json格式见文档[自定义与拓展](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.html)。命令行,`--custom_dataset_info xxx.json``--dataset dataset_name`
15+
16+
### Q4: 如何在界面训练使用自定义数据集?
17+
界面训练使用自定义数据集与命令行一致,参考文档[自定义与拓展](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.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_id_or_path 本地路径``--check_model_is_latest 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,详见文档[OLLaMA导出文档](https://swift.readthedocs.io/zh-cn/latest/LLM/OLLAMA%E5%AF%BC%E5%87%BA%E6%96%87%E6%A1%A3.html)
33+
34+
### Q10: swift支持预训练吗,我看只有sft?
35+
支持,命令行`swift pt`,数据集格式见[自定义与拓展](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.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/%E6%A8%A1%E5%9E%8B%E7%9A%84%E4%B8%8B%E8%BD%BD)。训练时`--model_id_or_path`配置本地路径即可。如果需要在离线环境训练,配置`--check_model_is_latest 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+
[Qwen2-VL 最佳实践](https://swift.readthedocs.io/zh-cn/latest/Multi-Modal/qwen2-vl%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.html)
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+
```shell
66+
# 多机多卡
67+
# 如果非共用磁盘请在各机器sh中额外指定`--save_on_each_node true`.
68+
# node0
69+
CUDA_VISIBLE_DEVICES=0,1,2,3 \
70+
NNODES=2 \
71+
NODE_RANK=0 \
72+
MASTER_ADDR=127.0.0.1 \
73+
NPROC_PER_NODE=4 \
74+
swift sft \
75+
--model_id_or_path qwen/Qwen-7B-Chat \
76+
--dataset AI-ModelScope/blossom-math-v2 \
77+
--output_dir output \
78+
# node1
79+
CUDA_VISIBLE_DEVICES=0,1,2,3 \
80+
NNODES=2 \
81+
NODE_RANK=1 \
82+
MASTER_ADDR=xxx.xxx.xxx.xxx \
83+
NPROC_PER_NODE=4 \
84+
swift sft \
85+
--model_id_or_path qwen/Qwen-7B-Chat \
86+
--dataset AI-ModelScope/blossom-math-v2 \
87+
--output_dir output \
88+
```
89+
详见[LLM微调文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/LLM%E5%BE%AE%E8%B0%83%E6%96%87%E6%A1%A3.html)
90+
91+
### Q19: 如何选择template?
92+
[issue](https://github.com/modelscope/ms-swift/issues/1813)
93+
94+
### Q20: 多卡训练torchrun和swift sft如何使用?
95+
`swift sft`走的就是`torchrun`
96+
97+
### Q21: 有个问题,因为我的sft数据集太大了,然后每次tokenize都需要很久,有解决方案吗?
98+
使用`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)
99+
100+
### Q22: 训练时,如果两个数据集直接追加一起放在训练集中,模型在训练的时候内部会有shuffle的流程吗?还是按顺序取数据去训练?
101+
trainer中会随机。
102+
103+
## 推理
104+
105+
### Q1:swift推理有文档吗?
106+
swift支持python脚本、命令行、ui界面推理,详见[LLM推理文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/LLM%E6%8E%A8%E7%90%86%E6%96%87%E6%A1%A3.html)
107+
108+
### Q2: 训练后的模型如何使用数据集推理?
109+
参数`--load_dataset_config true``--val_dataset <your-val-dataset>`,见文档[LLM微调文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/LLM%E5%BE%AE%E8%B0%83%E6%96%87%E6%A1%A3.html#%E5%BE%AE%E8%B0%83%E5%90%8E%E6%A8%A1%E5%9E%8B)
110+
111+
### Q3: swift推理的时候可以指定下载好的模型吗?
112+
`--model_id_or_path`配置本地路径即可,详见[命令行参数](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%8F%82%E6%95%B0.html)
113+
114+
### Q4: 我想在一个没有label的数据集上推理,怎么做呢?我看文档里面的数据集格式都是训练集
115+
配置参数`--val_dataset <your-val-dataset>`
116+
117+
### Q5: 遇到报错ValueError: Input length of input_ids is 35, but `max_length` is set to 20.如何解决?
118+
```text
119+
raise ValueError(
120+
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`.
121+
```
122+
设置model.generation_config.max_new_tokens。
123+
124+
### Q6: qwen2-vl推理爆显存
125+
设置环境变量,SIZE_FACTOR=8 MAX_PIXELS=602112,见文档[Qwen2-VL 最佳实践](https://swift.readthedocs.io/zh-cn/latest/Multi-Modal/qwen2-vl%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.html)
126+
127+
## 部署
128+
129+
### Q1: 如何部署训练后的模型?
130+
`swift deploy --ckpt_dir xxx`,见文档[VLLM推理加速与部署](https://swift.readthedocs.io/zh-cn/latest/LLM/VLLM%E6%8E%A8%E7%90%86%E5%8A%A0%E9%80%9F%E4%B8%8E%E9%83%A8%E7%BD%B2.html)
131+
132+
### Q2: 如何使用vllm部署进行多卡部署?
133+
`RAY_memory_monitor_refresh_ms=0 CUDA_VISIBLE_DEVICES=0,1,2,3 swift deploy --model_type qwen-7b --tensor_parallel_size 4`,见文档[VLLM推理加速与部署](https://swift.readthedocs.io/zh-cn/latest/LLM/VLLM%E6%8E%A8%E7%90%86%E5%8A%A0%E9%80%9F%E4%B8%8E%E9%83%A8%E7%BD%B2.html)
134+
135+
### Q3: 请问用vllm部署的时候,客户端怎么传入图片?
136+
详见多模态文档,[vLLM推理加速文档](https://swift.readthedocs.io/zh-cn/latest/Multi-Modal/vLLM%E6%8E%A8%E7%90%86%E5%8A%A0%E9%80%9F%E6%96%87%E6%A1%A3.html)
137+
138+
### Q4: 有个问题想问一下,qwen2-7b部署后使用客户端时,调用openai的api要使用client.completions.create,不能使用client.chat.completions.create,但是使用qwen2-7b-instruct-q5_k_m.gguf的时候可以使用client.chat.completions.create,这是为什么呀?
139+
base模型可以用client.chat.completions.create的,不过这个是兼容行为。
140+
141+
### Q5: 使用两张卡用swift deploy启动服务端后,用Ctrl+C退出后,会一直有一个python进程,一直占用一张卡的显存,这是正常现象吗?
142+
需要kill 一下, 这是vllm的问题。
143+
144+
## 评测
145+
146+
### Q1: swift支持的评测集有哪些?
147+
纯文本评测:
148+
```text
149+
'obqa', 'cmb', 'AX_b', 'siqa', 'nq', 'mbpp', 'winogrande', 'mmlu', 'BoolQ', 'cluewsc', 'ocnli', 'lambada',
150+
'CMRC', 'ceval', 'csl', 'cmnli', 'bbh', 'ReCoRD', 'math', 'humaneval', 'eprstmt', 'WSC', 'storycloze',
151+
'MultiRC', 'RTE', 'chid', 'gsm8k', 'AX_g', 'bustm', 'afqmc', 'piqa', 'lcsts', 'strategyqa', 'Xsum', 'agieval',
152+
'ocnli_fc', 'C3', 'tnews', 'race', 'triviaqa', 'CB', 'WiC', 'hellaswag', 'summedits', 'GaokaoBench',
153+
'ARC_e', 'COPA', 'ARC_c', 'DRCD'
154+
```
155+
156+
多模态评测:
157+
```text
158+
'COCO_VAL', 'MME', 'HallusionBench', 'POPE', 'MMBench_DEV_EN', 'MMBench_TEST_EN', 'MMBench_DEV_CN', 'MMBench_TEST_CN',
159+
'MMBench', 'MMBench_CN', 'MMBench_DEV_EN_V11', 'MMBench_TEST_EN_V11', 'MMBench_DEV_CN_V11',
160+
'MMBench_TEST_CN_V11', 'MMBench_V11', 'MMBench_CN_V11', 'SEEDBench_IMG', 'SEEDBench2',
161+
'SEEDBench2_Plus', 'ScienceQA_VAL', 'ScienceQA_TEST', 'MMT-Bench_ALL_MI', 'MMT-Bench_ALL',
162+
'MMT-Bench_VAL_MI', 'MMT-Bench_VAL', 'AesBench_VAL', 'AesBench_TEST', 'CCBench', 'AI2D_TEST', 'MMStar',
163+
'RealWorldQA', 'MLLMGuard_DS', 'BLINK', 'OCRVQA_TEST', 'OCRVQA_TESTCORE', 'TextVQA_VAL', 'DocVQA_VAL',
164+
'DocVQA_TEST', 'InfoVQA_VAL', 'InfoVQA_TEST', 'ChartQA_TEST', 'MathVision', 'MathVision_MINI',
165+
'MMMU_DEV_VAL', 'MMMU_TEST', 'OCRBench', 'MathVista_MINI', 'LLaVABench', 'MMVet', 'MTVQA_TEST',
166+
'MMLongBench_DOC', 'VCR_EN_EASY_500', 'VCR_EN_EASY_100', 'VCR_EN_EASY_ALL', 'VCR_EN_HARD_500',
167+
'VCR_EN_HARD_100', 'VCR_EN_HARD_ALL', 'VCR_ZH_EASY_500', 'VCR_ZH_EASY_100', 'VCR_ZH_EASY_ALL',
168+
'VCR_ZH_HARD_500', 'VCR_ZH_HARD_100', 'VCR_ZH_HARD_ALL', 'MMDU', 'MMBench-Video', 'Video-MME',
169+
'MMBench_DEV_EN', 'MMBench_TEST_EN', 'MMBench_DEV_CN', 'MMBench_TEST_CN', 'MMBench', 'MMBench_CN',
170+
'MMBench_DEV_EN_V11', 'MMBench_TEST_EN_V11', 'MMBench_DEV_CN_V11', 'MMBench_TEST_CN_V11', 'MMBench_V11',
171+
'MMBench_CN_V11', 'SEEDBench_IMG', 'SEEDBench2', 'SEEDBench2_Plus', 'ScienceQA_VAL', 'ScienceQA_TEST',
172+
'MMT-Bench_ALL_MI', 'MMT-Bench_ALL', 'MMT-Bench_VAL_MI', 'MMT-Bench_VAL', 'AesBench_VAL',
173+
'AesBench_TEST', 'CCBench', 'AI2D_TEST', 'MMStar', 'RealWorldQA', 'MLLMGuard_DS', 'BLINK'
174+
```
175+
176+
详见文档[LLM评测文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/LLM%E8%AF%84%E6%B5%8B%E6%96%87%E6%A1%A3.html)
177+
178+
### Q2: 如何使用自定义评测集?
179+
纯文本、多模态自定义评测集必须和某个官方评测集数据格式(pattern)保持一致,见文档[LLM评测文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/LLM%E8%AF%84%E6%B5%8B%E6%96%87%E6%A1%A3.html)

docs/source/Instruction/命令行参数.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,17 @@ PT参数继承了sft参数,并修改了部分默认值.
278278
## RLHF 参数
279279

280280
RLHF参数继承了sft参数, 除此之外增加了以下参数:
281-
- `--🔥rlhf_type`: 选择对齐算法,可选项为'dpo', 'orpo', 'simpo', 'kto', 'cpo', 训练脚本请查看[文档](../LLM/人类偏好对齐训练文档.md)
282-
- `--🔥ref_model_type`: 选择参考模型, 同model_type参数, 默认与训练模型一致。其中`cpo``simpo`算法无需选择。
281+
- `--🔥rlhf_type`: 选择对齐算法,可选项为'dpo', 'orpo', 'simpo', 'kto', 'cpo', 默认为`'dpo'`.训练脚本请查看[文档](../LLM/人类偏好对齐训练文档.md)
282+
- `--🔥ref_model_type`: 选择参考模型, 同model_type参数, 默认为`None`, 与训练模型一致。其中`cpo`, `simpo`, `orpo`算法无需选择。
283283
- `--🔥ref_model_id_or_path`: 参考模型的本地cache路径, 默认为`None`.
284-
- `--max_prompt_length`: 最大的提示长度, 该参数会传入相应的Trainer中, 使prompt长度不超过该值的设置, 默认值`1024`.
285-
- `--beta`: KL正则项系数, `simpo`算法默认为2.0, 其他算法默认为0.1, 具体参考[文档](../LLM/人类偏好对齐训练文档.md)
286-
- `--label_smoothing`: 是否使用DPO smoothing, 默认值为0,一般设置在0~0.5之间.
287-
- `--loss_type`: loss类型, 默认值'sigmoid'.
288-
- `--truncation_mode`: truncation_mode类型, 默认为`keep_end`, 对于过长的数据保留尾部。
289-
- `--sft_beta`: 是否在DPO中加入sft loss, 默认为0.1, 支持 $[0, 1)$ 区间,最后的loss为`(1-sft_beta)*KL_loss + sft_beta * sft_loss`.
290-
- `--simpo_gamma`: SimPO算法中的reward margin项,论文中建议设置为0.5-1.5, 默认为1.0
291-
- `--cpo_alpha`: CPO loss 中 nll loss的系数, 默认为1.0, 在SimPO中使用混合nll loss以提高训练稳定性
292-
- `--desirable_weight`: KTO算法中对desirable response的loss权重 $\lambda_D$ ,默认为1.0
293-
- `--undesirable_weight`: KTO论文中对undesirable response的loss权重 $\lambda_U$ , 默认为1.0. 分别用$n_d$ 和$n_u$ 表示数据集中desirable examples和undesirable examples的数量,论文中推荐控制 $\frac{\lambda_D n_D}{\lambda_Un_U} \in [1,\frac{4}{3}]$
284+
- `--beta`: KL正则项系数, 默认为`None`, 即`simpo`算法默认为`2.`, 其他算法默认为`0.1`. 具体参考[文档](../LLM/人类偏好对齐训练文档.md)
285+
- `--label_smoothing`: 是否使用DPO smoothing, 默认值为`0`,一般设置在0~0.5之间.
286+
- `--loss_type`: loss类型, 默认为`None`, 如果是dpo, cpo则为`sigmoid`, 如果是simpo则为`simpo`.
287+
- `--rpo_alpha`: 控制DPO中加入sft_loss的权重, 默认为`1`. 最后的loss为`KL_loss + rpo_alpha * sft_loss`.
288+
- `--cpo_alpha`: CPO/SimPO loss 中 nll loss的系数, 默认为`1.`.
289+
- `--simpo_gamma`: SimPO算法中的reward margin项,论文中建议设置为0.5-1.5, 默认为`1.`
290+
- `--desirable_weight`: KTO算法中对desirable response的loss权重 $\lambda_D$ ,默认为`1.`
291+
- `--undesirable_weight`: KTO论文中对undesirable response的loss权重 $\lambda_U$ , 默认为`1.`. 分别用$n_d$ 和$n_u$ 表示数据集中desirable examples和undesirable examples的数量,论文中推荐控制 $\frac{\lambda_D n_D}{\lambda_Un_U} \in [1,\frac{4}{3}]$
294292

295293
## infer merge-lora 参数
296294

0 commit comments

Comments
 (0)