2024-05-18 21:37:38 +08:00
|
|
|
|
[dataset_info.json](dataset_info.json) 包含了所有可用的数据集。如果您希望使用自定义数据集,请**务必**在 `dataset_info.json` 文件中添加*数据集描述*,并通过修改 `dataset: 数据集名称` 配置来使用数据集。
|
2024-05-18 21:15:20 +08:00
|
|
|
|
|
|
|
|
|
目前我们支持 **alpaca** 格式和 **sharegpt** 格式的数据集。
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
2023-12-18 19:09:31 +08:00
|
|
|
|
"hf_hub_url": "Hugging Face 的数据集仓库地址(若指定,则忽略 script_url 和 file_name)",
|
|
|
|
|
"ms_hub_url": "ModelScope 的数据集仓库地址(若指定,则忽略 script_url 和 file_name)",
|
|
|
|
|
"script_url": "包含数据加载脚本的本地文件夹名称(若指定,则忽略 file_name)",
|
2024-05-21 18:30:59 +08:00
|
|
|
|
"file_name": "该目录下数据集文件夹或文件的名称(若上述参数未指定,则此项必需)",
|
2024-05-18 21:15:20 +08:00
|
|
|
|
"formatting": "数据集格式(可选,默认:alpaca,可以为 alpaca 或 sharegpt)",
|
|
|
|
|
"ranking": "是否为偏好数据集(可选,默认:False)",
|
2023-11-03 00:15:23 +08:00
|
|
|
|
"subset": "数据集子集的名称(可选,默认:None)",
|
2024-07-15 01:04:56 +08:00
|
|
|
|
"split": "所使用的数据集切分(可选,默认:train)",
|
2023-12-09 20:53:18 +08:00
|
|
|
|
"folder": "Hugging Face 仓库的文件夹名称(可选,默认:None)",
|
2024-07-15 01:04:56 +08:00
|
|
|
|
"num_samples": "该数据集所使用的样本数量。(可选,默认:None)",
|
2024-02-10 16:39:19 +08:00
|
|
|
|
"columns(可选)": {
|
2024-01-21 22:17:48 +08:00
|
|
|
|
"prompt": "数据集代表提示词的表头名称(默认:instruction)",
|
|
|
|
|
"query": "数据集代表请求的表头名称(默认:input)",
|
|
|
|
|
"response": "数据集代表回答的表头名称(默认:output)",
|
|
|
|
|
"history": "数据集代表历史对话的表头名称(默认:None)",
|
|
|
|
|
"messages": "数据集代表消息列表的表头名称(默认:conversations)",
|
|
|
|
|
"system": "数据集代表系统提示的表头名称(默认:None)",
|
2024-04-26 05:34:58 +08:00
|
|
|
|
"tools": "数据集代表工具描述的表头名称(默认:None)",
|
2024-05-18 03:44:56 +08:00
|
|
|
|
"images": "数据集代表图像输入的表头名称(默认:None)",
|
2024-05-18 21:15:20 +08:00
|
|
|
|
"chosen": "数据集代表更优回答的表头名称(默认:None)",
|
|
|
|
|
"rejected": "数据集代表更差回答的表头名称(默认:None)",
|
2024-05-18 03:44:56 +08:00
|
|
|
|
"kto_tag": "数据集代表 KTO 标签的表头名称(默认:None)"
|
2024-01-21 22:17:48 +08:00
|
|
|
|
},
|
2024-02-10 16:39:19 +08:00
|
|
|
|
"tags(可选,用于 sharegpt 格式)": {
|
2024-01-21 22:17:48 +08:00
|
|
|
|
"role_tag": "消息中代表发送者身份的键名(默认:from)",
|
|
|
|
|
"content_tag": "消息中代表文本内容的键名(默认:value)",
|
|
|
|
|
"user_tag": "消息中代表用户的 role_tag(默认:human)",
|
|
|
|
|
"assistant_tag": "消息中代表助手的 role_tag(默认:gpt)",
|
|
|
|
|
"observation_tag": "消息中代表工具返回结果的 role_tag(默认:observation)",
|
2024-02-10 16:39:19 +08:00
|
|
|
|
"function_tag": "消息中代表工具调用的 role_tag(默认:function_call)",
|
2024-05-30 00:04:47 +08:00
|
|
|
|
"system_tag": "消息中代表系统提示的 role_tag(默认:system,会覆盖 system column)"
|
|
|
|
|
}
|
2023-11-02 23:42:49 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
## Alpaca 格式
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
### 指令监督微调数据集
|
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](alpaca_zh_demo.json)
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
在指令监督微调时,`instruction` 列对应的内容会与 `input` 列对应的内容拼接后作为人类指令,即人类指令为 `instruction\ninput`。而 `output` 列对应的内容为模型回答。
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
如果指定,`system` 列对应的内容将被作为系统提示词。
|
2024-03-31 18:29:50 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
`history` 列是由多个字符串二元组构成的列表,分别代表历史消息中每轮对话的指令和回答。注意在指令监督微调时,历史消息中的回答内容**也会被用于模型学习**。
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
2024-05-18 03:44:56 +08:00
|
|
|
|
"instruction": "人类指令(必填)",
|
|
|
|
|
"input": "人类输入(选填)",
|
2023-11-03 00:15:23 +08:00
|
|
|
|
"output": "模型回答(必填)",
|
2023-12-12 19:45:59 +08:00
|
|
|
|
"system": "系统提示词(选填)",
|
2023-11-03 00:15:23 +08:00
|
|
|
|
"history": [
|
|
|
|
|
["第一轮指令(选填)", "第一轮回答(选填)"],
|
|
|
|
|
["第二轮指令(选填)", "第二轮回答(选填)"]
|
2023-11-02 23:42:49 +08:00
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
2023-07-21 16:57:58 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
2024-05-02 02:14:55 +08:00
|
|
|
|
"file_name": "data.json",
|
2023-07-21 16:57:58 +08:00
|
|
|
|
"columns": {
|
2023-11-02 23:42:49 +08:00
|
|
|
|
"prompt": "instruction",
|
|
|
|
|
"query": "input",
|
|
|
|
|
"response": "output",
|
2023-12-12 19:45:59 +08:00
|
|
|
|
"system": "system",
|
2023-11-02 23:42:49 +08:00
|
|
|
|
"history": "history"
|
2023-09-01 19:00:45 +08:00
|
|
|
|
}
|
2023-07-21 16:57:58 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
### 预训练数据集
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](c4_demo.json)
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
在预训练时,只有 `text` 列中的内容会用于模型学习。
|
2023-08-22 13:30:57 +08:00
|
|
|
|
|
2024-05-02 02:14:55 +08:00
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{"text": "document"},
|
|
|
|
|
{"text": "document"}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
2023-08-22 19:46:09 +08:00
|
|
|
|
|
2023-08-22 13:30:57 +08:00
|
|
|
|
```json
|
2024-05-02 02:14:55 +08:00
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"columns": {
|
|
|
|
|
"prompt": "text"
|
|
|
|
|
}
|
2023-08-22 13:30:57 +08:00
|
|
|
|
}
|
|
|
|
|
```
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
### 偏好数据集
|
|
|
|
|
|
|
|
|
|
偏好数据集用于奖励模型训练、DPO 训练和 ORPO 训练。
|
|
|
|
|
|
|
|
|
|
它需要在 `chosen` 列中提供更优的回答,并在 `rejected` 列中提供更差的回答。
|
2024-05-02 02:14:55 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
2024-05-18 21:15:20 +08:00
|
|
|
|
"instruction": "人类指令(必填)",
|
|
|
|
|
"input": "人类输入(选填)",
|
|
|
|
|
"chosen": "优质回答(必填)",
|
|
|
|
|
"rejected": "劣质回答(必填)"
|
2024-05-02 02:14:55 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
2024-05-02 02:14:55 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"ranking": true,
|
|
|
|
|
"columns": {
|
|
|
|
|
"prompt": "instruction",
|
|
|
|
|
"query": "input",
|
2024-05-18 03:44:56 +08:00
|
|
|
|
"chosen": "chosen",
|
|
|
|
|
"rejected": "rejected"
|
2024-05-02 02:14:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
2024-03-31 18:29:50 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
### KTO 数据集
|
2024-03-31 18:29:50 +08:00
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](kto_en_demo.json)
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
KTO 数据集需要额外添加一个 `kto_tag` 列,包含 bool 类型的人类反馈。
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"instruction": "人类指令(必填)",
|
|
|
|
|
"input": "人类输入(选填)",
|
|
|
|
|
"output": "模型回答(必填)",
|
|
|
|
|
"kto_tag": "人类反馈 [true/false](必填)"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"columns": {
|
|
|
|
|
"prompt": "instruction",
|
|
|
|
|
"query": "input",
|
|
|
|
|
"response": "output",
|
|
|
|
|
"kto_tag": "kto_tag"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 多模态数据集
|
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](mllm_demo.json)
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
多模态数据集需要额外添加一个 `images` 列,包含输入图像的路径。目前我们仅支持单张图像输入。
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"instruction": "人类指令(必填)",
|
|
|
|
|
"input": "人类输入(选填)",
|
|
|
|
|
"output": "模型回答(必填)",
|
|
|
|
|
"images": [
|
|
|
|
|
"图像路径(必填)"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"columns": {
|
|
|
|
|
"prompt": "instruction",
|
|
|
|
|
"query": "input",
|
|
|
|
|
"response": "output",
|
|
|
|
|
"images": "images"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Sharegpt 格式
|
|
|
|
|
|
|
|
|
|
### 指令监督微调数据集
|
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](glaive_toolcall_zh_demo.json)
|
|
|
|
|
|
|
|
|
|
相比 alpaca 格式的数据集,sharegpt 格式支持**更多的角色种类**,例如 human、gpt、observation、function 等等。它们构成一个对象列表呈现在 `conversations` 列中。
|
2024-05-18 21:15:20 +08:00
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
注意其中 human 和 observation 必须出现在奇数位置,gpt 和 function 必须出现在偶数位置。
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
2023-11-03 00:15:23 +08:00
|
|
|
|
"conversations": [
|
|
|
|
|
{
|
|
|
|
|
"from": "human",
|
2024-05-18 21:15:20 +08:00
|
|
|
|
"value": "人类指令"
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-05-18 21:37:38 +08:00
|
|
|
|
"from": "function_call",
|
|
|
|
|
"value": "工具参数"
|
2024-05-18 21:15:20 +08:00
|
|
|
|
},
|
2023-11-03 00:15:23 +08:00
|
|
|
|
{
|
2024-05-18 21:37:38 +08:00
|
|
|
|
"from": "observation",
|
|
|
|
|
"value": "工具结果"
|
2023-11-03 00:15:23 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"from": "gpt",
|
|
|
|
|
"value": "模型回答"
|
|
|
|
|
}
|
2023-12-12 19:45:59 +08:00
|
|
|
|
],
|
2024-01-21 22:17:48 +08:00
|
|
|
|
"system": "系统提示词(选填)",
|
|
|
|
|
"tools": "工具描述(选填)"
|
2023-11-02 23:42:49 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
2023-11-02 23:42:49 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
2024-05-02 02:14:55 +08:00
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"formatting": "sharegpt",
|
2023-11-02 23:42:49 +08:00
|
|
|
|
"columns": {
|
|
|
|
|
"messages": "conversations",
|
2024-01-21 22:17:48 +08:00
|
|
|
|
"system": "system",
|
|
|
|
|
"tools": "tools"
|
2023-11-02 23:42:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
### 偏好数据集
|
|
|
|
|
|
2024-05-18 21:37:38 +08:00
|
|
|
|
- [样例数据集](dpo_zh_demo.json)
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
Sharegpt 格式的偏好数据集同样需要在 `chosen` 列中提供更优的消息,并在 `rejected` 列中提供更差的消息。
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"conversations": [
|
|
|
|
|
{
|
|
|
|
|
"from": "human",
|
|
|
|
|
"value": "人类指令"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"from": "gpt",
|
|
|
|
|
"value": "模型回答"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"from": "human",
|
|
|
|
|
"value": "人类指令"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"chosen": {
|
|
|
|
|
"from": "gpt",
|
|
|
|
|
"value": "优质回答"
|
|
|
|
|
},
|
|
|
|
|
"rejected": {
|
|
|
|
|
"from": "gpt",
|
|
|
|
|
"value": "劣质回答"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"formatting": "sharegpt",
|
|
|
|
|
"ranking": true,
|
|
|
|
|
"columns": {
|
|
|
|
|
"messages": "conversations",
|
|
|
|
|
"chosen": "chosen",
|
|
|
|
|
"rejected": "rejected"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### OpenAI 格式
|
2023-11-03 00:15:23 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
OpenAI 格式仅仅是 sharegpt 格式的一种特殊情况,其中第一条消息可能是系统提示词。
|
2024-05-02 02:14:55 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"messages": [
|
|
|
|
|
{
|
|
|
|
|
"role": "system",
|
|
|
|
|
"content": "系统提示词(选填)"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"role": "user",
|
2024-05-18 03:44:56 +08:00
|
|
|
|
"content": "人类指令"
|
2024-05-02 02:14:55 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"role": "assistant",
|
|
|
|
|
"content": "模型回答"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
|
2024-05-02 02:14:55 +08:00
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"数据集名称": {
|
|
|
|
|
"file_name": "data.json",
|
|
|
|
|
"formatting": "sharegpt",
|
|
|
|
|
"columns": {
|
|
|
|
|
"messages": "messages"
|
2024-01-21 22:17:48 +08:00
|
|
|
|
},
|
|
|
|
|
"tags": {
|
2024-05-02 02:14:55 +08:00
|
|
|
|
"role_tag": "role",
|
|
|
|
|
"content_tag": "content",
|
|
|
|
|
"user_tag": "user",
|
|
|
|
|
"assistant_tag": "assistant",
|
|
|
|
|
"system_tag": "system"
|
2023-11-02 23:42:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
Sharegpt 格式中的 KTO 数据集和多模态数据集与 alpaca 格式的类似。
|
2023-11-03 00:15:23 +08:00
|
|
|
|
|
2024-05-18 21:15:20 +08:00
|
|
|
|
预训练数据集**不支持** sharegpt 格式。
|