Skip to content

Commit 1be2d72

Browse files
authored
update agent doc (#1189)
1 parent 4e6b511 commit 1be2d72

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

docs/source/LLM/Agent微调最佳实践.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,38 @@ pip install -r requirements/llm.txt -U
3030

3131
## 数据准备
3232

33-
为训练Agent能力,魔搭官方提供了两个开源数据集:
33+
swift现支持的agent数据集:
34+
- [msagent-pro](https://www.modelscope.cn/datasets/iic/MSAgent-Pro)
35+
- [toolbench](https://www.modelscope.cn/datasets/swift/ToolBench)
36+
- [ms-agent](https://www.modelscope.cn/datasets/iic/ms_agent)
37+
- [ms-agent-for-agentfabric](https://www.modelscope.cn/datasets/AI-ModelScope/ms_agent_for_agentfabric)
38+
- [ms-agent-multirole](https://www.modelscope.cn/datasets/iic/MSAgent-MultiRole)
39+
- [toolbench-for-alpha-umi](https://www.modelscope.cn/datasets/shenweizhou/alpha-umi-toolbench-processed-v2)
40+
- [damo-agent-zh](https://www.modelscope.cn/datasets/iic/MSAgent-Bench)
41+
- [agent-instruct-all-en](https://www.modelscope.cn/datasets/huangjintao/AgentInstruct_copy)
42+
43+
你也可以使用自定义Agent数据集进行训练, 现支持两种格式
44+
45+
格式1
46+
```jsonl
47+
{"tools":"{API_LIST}","conversations": [{"from": "system", "value": "00000"}, {"from": "user", "value": "11111"}, {"from": "assistant", "value": "22222"}]}
48+
{"tools":"{API_LIST}","conversations": [{"from": "user", "value": "aaaaa"}, {"from": "assistant", "value": "bbbbb"}, {"from": "tool", "value": "ccccc"}, {"from": "assistant", "value": "ddddd"}]}
49+
{"tools":"{API_LIST}","conversations": [{"from": "user", "value": "AAAAA"}, {"from": "assistant", "value": "BBBBB"}, {"from": "tool", "value": "CCCCC"}, {"from": "assistant", "value": "DDDDD"}]}
50+
```
51+
52+
格式2
53+
```jsonl
54+
{"tools":"{API_LIST}","messages": [{"role": "system", "content": "00000"}, {"role": "user", "content": "11111"}, {"role": "assistant", "content": "22222"}]}
55+
{"tools":"{API_LIST}","messages": [{"role": "user", "content": "aaaaa"}, {"role": "assistant", "content": "bbbbb"}, {"role": "tool", "content": "ccccc"}, {"role": "assistant", "content": "ddddd"}]}
56+
{"tools":"{API_LIST}","messages": [{"role": "user", "content": "AAAAA"}, {"role": "assistant", "content": "BBBBB"}, {"role": "tool", "content": "CCCCC"}, {"role": "assistant", "content": "DDDDD"}]}
57+
```
58+
59+
其中tools格式参考[Agent部署文档](./Agent部署最佳实践.md#tools字段), 提供可调用的工具列表, 你可以通过设置`--tools_prompt`来选择对应的prompt
60+
61+
`tool`字段表示工具调用返回结果
62+
3463

64+
如果你想保留模型的通用能力, 可以混合一定比例的通用数据集, 以下以混合ms-bench和ms-agent数据集训练agent为例,
3565
- [魔搭通用问答知识数据集](https://www.modelscope.cn/datasets/iic/ms_bench/summary) 该数据集包含了38万条通用知识多轮对话数据
3666
- [魔搭通用Agent训练数据集](https://www.modelscope.cn/datasets/iic/ms_agent/summary) 该数据集包含了3万条Agent格式的API调用数据
3767

docs/source_en/LLM/Agent-fine-tuning-best-practice.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ pip install -r requirements/llm.txt -U
2727
```
2828

2929
## Data Preparation
30+
Supported agent datasets in swift now include::
31+
- [msagent-pro](https://www.modelscope.cn/datasets/iic/MSAgent-Pro)
32+
- [toolbench](https://www.modelscope.cn/datasets/swift/ToolBench)
33+
- [ms-agent](https://www.modelscope.cn/datasets/iic/ms_agent)
34+
- [ms-agent-for-agentfabric](https://www.modelscope.cn/datasets/AI-ModelScope/ms_agent_for_agentfabric)
35+
- [ms-agent-multirole](https://www.modelscope.cn/datasets/iic/MSAgent-MultiRole)
36+
- [toolbench-for-alpha-umi](https://www.modelscope.cn/datasets/shenweizhou/alpha-umi-toolbench-processed-v2)
37+
- [damo-agent-zh](https://www.modelscope.cn/datasets/iic/MSAgent-Bench)
38+
- [agent-instruct-all-en](https://www.modelscope.cn/datasets/huangjintao/AgentInstruct_copy)
39+
40+
You can also train using custom Agent datasets, now supporting two formats
41+
42+
format 1
43+
```jsonl
44+
{"tools":"{API_LIST}","conversations": [{"from": "system", "value": "00000"}, {"from": "user", "value": "11111"}, {"from": "assistant", "value": "22222"}]}
45+
{"tools":"{API_LIST}","conversations": [{"from": "user", "value": "aaaaa"}, {"from": "assistant", "value": "bbbbb"}, {"from": "tool", "value": "ccccc"}, {"from": "assistant", "value": "ddddd"}]}
46+
{"tools":"{API_LIST}","conversations": [{"from": "user", "value": "AAAAA"}, {"from": "assistant", "value": "BBBBB"}, {"from": "tool", "value": "CCCCC"}, {"from": "assistant", "value": "DDDDD"}]}
47+
```
48+
49+
format 2
50+
```jsonl
51+
{"tools":"{API_LIST}","messages": [{"role": "system", "content": "00000"}, {"role": "user", "content": "11111"}, {"role": "assistant", "content": "22222"}]}
52+
{"tools":"{API_LIST}","messages": [{"role": "user", "content": "aaaaa"}, {"role": "assistant", "content": "bbbbb"}, {"role": "tool", "content": "ccccc"}, {"role": "assistant", "content": "ddddd"}]}
53+
{"tools":"{API_LIST}","messages": [{"role": "user", "content": "AAAAA"}, {"role": "assistant", "content": "BBBBB"}, {"role": "tool", "content": "CCCCC"}, {"role": "assistant", "content": "DDDDD"}]}
54+
```
55+
56+
For the tools format, please refer to [Agent-Deoloyment Document](./Agent-deployment-best-practice.md) You can choose the corresponding prompt by setting `--tools_prompt`.
57+
58+
The `tool` field represents the return result of the tool calling.
59+
60+
61+
If you want to maintain the model's general capability, you can mix a certain proportion of general-purpose datasets. Here’s an example of training an agent by blending the ms-bench and ms-agent datasets:
3062

3163
For training Agent capability, the ModelScope team officially provides two open-source datasets:
3264

docs/source_en/LLM/Customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Adding dataset_id:
153153
}
154154
```
155155

156-
添加dataset\_path:
156+
Adding dataset\_path:
157157
```python
158158
# You can specify relative and absolute paths. Relative paths are relative to the directory where dataset_info.json is located.
159159
# Usage: `--dataset <dataset_name>`

0 commit comments

Comments
 (0)