2024-05-01 18:13:46 +00:00
If you are using a custom dataset, please add your **dataset description** to `dataset_info.json` according to the following format. We also provide several examples in the next section.
2023-07-19 12:59:15 +00:00
2023-05-28 10:09:04 +00:00
```json
"dataset_name": {
2023-12-18 11:09:31 +00:00
"hf_hub_url": "the name of the dataset repository on the Hugging Face hub. (if specified, ignore script_url and file_name)",
"ms_hub_url": "the name of the dataset repository on the ModelScope hub. (if specified, ignore script_url and file_name)",
"script_url": "the name of the directory containing a dataset loading script. (if specified, ignore file_name)",
2023-12-09 12:53:18 +00:00
"file_name": "the name of the dataset file in this directory. (required if above are not specified)",
2023-11-02 16:15:23 +00:00
"file_sha1": "the SHA-1 hash value of the dataset file. (optional, does not affect training)",
"subset": "the name of the subset. (optional, default: None)",
2023-12-09 12:53:18 +00:00
"folder": "the name of the folder of the dataset repository on the Hugging Face hub. (optional, default: None)",
2023-11-02 16:15:23 +00:00
"ranking": "whether the dataset is a preference dataset or not. (default: false)",
"formatting": "the format of the dataset. (optional, default: alpaca, can be chosen from {alpaca, sharegpt})",
2024-02-10 08:39:19 +00:00
"columns (optional)": {
2024-01-21 14:17:48 +00:00
"prompt": "the column name in the dataset containing the prompts. (default: instruction)",
"query": "the column name in the dataset containing the queries. (default: input)",
"response": "the column name in the dataset containing the responses. (default: output)",
"history": "the column name in the dataset containing the histories. (default: None)",
"messages": "the column name in the dataset containing the messages. (default: conversations)",
"system": "the column name in the dataset containing the system prompts. (default: None)",
2024-04-25 21:34:58 +00:00
"tools": "the column name in the dataset containing the tool description. (default: None)",
"images": "the column name in the dataset containing the image inputs. (default: None)"
2024-01-21 14:17:48 +00:00
},
2024-02-10 08:39:19 +00:00
"tags (optional, used for the sharegpt format)": {
2024-01-21 14:17:48 +00:00
"role_tag": "the key in the message represents the identity. (default: from)",
"content_tag": "the key in the message represents the content. (default: value)",
"user_tag": "the value of the role_tag represents the user. (default: human)",
"assistant_tag": "the value of the role_tag represents the assistant. (default: gpt)",
"observation_tag": "the value of the role_tag represents the tool results. (default: observation)",
2024-02-08 18:32:20 +00:00
"function_tag": "the value of the role_tag represents the function call. (default: function_call)",
2024-02-10 08:39:19 +00:00
"system_tag": "the value of the role_tag represents the system prompt. (default: system, can override system column)"
2023-09-01 11:00:45 +00:00
}
2023-05-28 10:09:04 +00:00
}
```
2024-05-01 18:13:46 +00:00
After that, you can load the custom dataset by specifying `--dataset dataset_name` .
2023-08-22 05:30:57 +00:00
2024-03-31 10:29:50 +00:00
----
2023-11-02 16:15:23 +00:00
Currently we support dataset in **alpaca** or **sharegpt** format, the dataset in alpaca format should follow the below format:
```json
[
{
"instruction": "user instruction (required)",
"input": "user input (optional)",
"output": "model response (required)",
2023-12-12 11:45:59 +00:00
"system": "system prompt (optional)",
2023-11-02 16:15:23 +00:00
"history": [
["user instruction in the first round (optional)", "model response in the first round (optional)"],
["user instruction in the second round (optional)", "model response in the second round (optional)"]
]
}
]
```
2024-05-01 18:13:46 +00:00
Regarding the above dataset, the description in `dataset_info.json` should be:
2023-11-02 16:15:23 +00:00
```json
"dataset_name": {
2024-05-01 18:13:46 +00:00
"file_name": "data.json",
2023-11-02 16:15:23 +00:00
"columns": {
"prompt": "instruction",
"query": "input",
"response": "output",
2023-12-12 11:45:59 +00:00
"system": "system",
2023-11-02 16:15:23 +00:00
"history": "history"
}
}
```
2024-02-10 13:04:29 +00:00
The `query` column will be concatenated with the `prompt` column and used as the user prompt, then the user prompt would be `prompt\nquery` . The `response` column represents the model response.
2023-11-02 16:15:23 +00:00
2024-05-01 18:13:46 +00:00
The `system` column will be used as the system prompt. The `history` column is a list consisting string tuples representing prompt-response pairs in the history. Note that the responses in the history **will also be used for training** in supervised fine-tuning.
2023-11-02 16:15:23 +00:00
2024-05-01 18:13:46 +00:00
For the **pre-training datasets** , only the `prompt` column will be used for training, for example:
2023-11-02 16:15:23 +00:00
2024-05-01 18:13:46 +00:00
```json
[
{"text": "document"},
{"text": "document"}
]
```
Regarding the above dataset, the description in `dataset_info.json` should be:
2023-08-22 11:46:09 +00:00
2023-08-22 05:30:57 +00:00
```json
2024-05-01 18:13:46 +00:00
"dataset_name": {
"file_name": "data.json",
"columns": {
"prompt": "text"
}
2023-08-22 05:30:57 +00:00
}
```
2023-11-02 16:15:23 +00:00
2024-05-01 18:13:46 +00:00
For the **preference datasets** , the `response` column should be a string list whose length is 2, with the preferred answers appearing first, for example:
```json
[
{
"instruction": "user instruction",
"input": "user input",
"output": [
"chosen answer",
"rejected answer"
]
}
]
```
Regarding the above dataset, the description in `dataset_info.json` should be:
```json
"dataset_name": {
"file_name": "data.json",
"ranking": true,
"columns": {
"prompt": "instruction",
"query": "input",
"response": "output",
}
}
```
2024-03-31 10:29:50 +00:00
----
2024-05-01 18:13:46 +00:00
The dataset in **sharegpt** format should follow the below format:
2023-11-02 16:15:23 +00:00
```json
[
{
"conversations": [
{
"from": "human",
2024-05-01 18:13:46 +00:00
"value": "user instruction"
2023-11-02 16:15:23 +00:00
},
{
"from": "gpt",
2024-05-01 18:13:46 +00:00
"value": "model response"
2023-11-02 16:15:23 +00:00
}
2023-12-12 11:45:59 +00:00
],
2024-05-01 18:13:46 +00:00
"system": "system prompt (optional)",
"tools": "tool description (optional)"
2023-11-02 16:15:23 +00:00
}
]
```
2024-05-01 18:13:46 +00:00
Regarding the above dataset, the description in `dataset_info.json` should be:
2023-11-02 16:15:23 +00:00
```json
"dataset_name": {
2024-05-01 18:13:46 +00:00
"file_name": "data.json",
"formatting": "sharegpt",
2023-11-02 16:15:23 +00:00
"columns": {
"messages": "conversations",
2024-01-21 14:17:48 +00:00
"system": "system",
"tools": "tools"
},
"tags": {
"role_tag": "from",
2024-01-31 03:58:07 +00:00
"content_tag": "value",
"user_tag": "human",
"assistant_tag": "gpt"
2023-11-02 16:15:23 +00:00
}
}
```
2024-02-10 13:04:29 +00:00
where the `messages` column should be a list following the `u/a/u/a/u/a` order.
2023-11-02 16:15:23 +00:00
2024-05-01 18:13:46 +00:00
We also supports the dataset in the **openai** format:
```json
[
{
"messages": [
{
"role": "system",
"content": "system prompt (optional)"
},
{
"role": "user",
"content": "user instruction"
},
{
"role": "assistant",
"content": "model response"
}
]
}
]
```
Regarding the above dataset, the description in `dataset_info.json` should be:
```json
"dataset_name": {
"file_name": "data.json",
"formatting": "sharegpt",
"columns": {
"messages": "messages"
},
"tags": {
"role_tag": "role",
"content_tag": "content",
"user_tag": "user",
"assistant_tag": "assistant",
"system_tag": "system"
}
}
```
Pre-training datasets and preference datasets are **incompatible** with the sharegpt format yet.