mirror of
				https://github.com/hiyouga/LLaMA-Factory.git
				synced 2025-11-04 18:02:19 +08:00 
			
		
		
		
	update data/readme
Former-commit-id: aa566e3cea5bc75688b4399a9da07be0b35b921c
This commit is contained in:
		
							parent
							
								
									1d16e87c5f
								
							
						
					
					
						commit
						62b6a7971a
					
				@ -65,9 +65,9 @@ Regarding the above dataset, the `columns` in `dataset_info.json` should be:
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
where the `prompt` and `response` columns should contain non-empty values, represent instruction and response respectively. The `query` column will be concatenated with the `prompt` column and used as input for the model.
 | 
			
		||||
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.
 | 
			
		||||
 | 
			
		||||
The `system` column will be used as the system prompt in the template. The `history` column is a list consisting string tuples representing query-response pairs in history. Note that the responses **in each round will be used for training**.
 | 
			
		||||
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**.
 | 
			
		||||
 | 
			
		||||
For the pre-training datasets, only the `prompt` column will be used for training.
 | 
			
		||||
 | 
			
		||||
@ -123,6 +123,6 @@ Regarding the above dataset, the `columns` in `dataset_info.json` should be:
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
where the `messages` column should be a list whose length is even, and follow the `u/a/u/a/u/a` order.
 | 
			
		||||
where the `messages` column should be a list following the `u/a/u/a/u/a` order.
 | 
			
		||||
 | 
			
		||||
Pre-training datasets and preference datasets are incompatible with the sharegpt format yet.
 | 
			
		||||
 | 
			
		||||
@ -65,9 +65,9 @@
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
其中 `prompt` 和 `response` 列应当是非空的字符串,分别代表用户指令和模型回答。`query` 列的内容将会和 `prompt` 列拼接作为模型输入。
 | 
			
		||||
其中 `query` 列对应的内容会与 `prompt` 列对应的内容拼接后作为用户指令,即用户指令为 `prompt\nquery`。`response` 列对应的内容为模型回答。
 | 
			
		||||
 | 
			
		||||
`system` 为模板中的系统提示词。`history` 列是由多个字符串二元组构成的列表,分别代表历史消息中每轮的指令和回答。注意每轮的模型回答**均会被用于训练**。
 | 
			
		||||
`system` 列对应的内容将被作为系统提示词。`history` 列是由多个字符串二元组构成的列表,分别代表历史消息中每轮的指令和回答。注意历史消息中的回答**也会被用于训练**。
 | 
			
		||||
 | 
			
		||||
对于预训练数据集,仅 `prompt` 列中的内容会用于模型训练。
 | 
			
		||||
 | 
			
		||||
@ -123,6 +123,6 @@
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
其中 `messages` 列必须为偶数长度的列表,且符合 `用户/模型/用户/模型/用户/模型` 的顺序。
 | 
			
		||||
其中 `messages` 列应当是一个列表,且符合 `用户/模型/用户/模型/用户/模型` 的顺序。
 | 
			
		||||
 | 
			
		||||
预训练数据集和偏好数据集尚不支持 sharegpt 格式。
 | 
			
		||||
 | 
			
		||||
@ -20,10 +20,14 @@ def convert_alpaca(examples: Dict[str, List[Any]], dataset_attr: "DatasetAttr")
 | 
			
		||||
                prompt.append({"role": Role.USER, "content": old_prompt})
 | 
			
		||||
                prompt.append({"role": Role.ASSISTANT, "content": old_response})
 | 
			
		||||
 | 
			
		||||
        instruction = examples[dataset_attr.prompt][i]
 | 
			
		||||
        content = []
 | 
			
		||||
        if dataset_attr.prompt and examples[dataset_attr.prompt][i]:
 | 
			
		||||
            content.append(examples[dataset_attr.prompt][i])
 | 
			
		||||
 | 
			
		||||
        if dataset_attr.query and examples[dataset_attr.query][i]:
 | 
			
		||||
            instruction += "\n" + examples[dataset_attr.query][i]
 | 
			
		||||
        prompt.append({"role": Role.USER, "content": instruction})
 | 
			
		||||
            content.append(examples[dataset_attr.query][i])
 | 
			
		||||
 | 
			
		||||
        prompt.append({"role": Role.USER, "content": "\n".join(content)})
 | 
			
		||||
 | 
			
		||||
        if dataset_attr.response and isinstance(examples[dataset_attr.response][i], list):
 | 
			
		||||
            response = [{"role": Role.ASSISTANT, "content": content} for content in examples[dataset_attr.response][i]]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user