QwenLM / Qwen

The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.
Apache License 2.0
13.59k stars 1.11k forks source link

SFT的数据是都需要处理成对话的形式吗? #1139

Closed yjdy closed 6 months ago

yjdy commented 6 months ago

您好,readme中只给出了以下conversation一种微调的数据格式。请问是要求所有的指令都需要处理成对话的形式吗? [ { "id": "identity_0", "conversations": [ { "from": "user", "value": "你好" }, { "from": "assistant", "value": "我是一个语言模型,我叫通义千问。" } ] } ]

单轮的指令是不是需要处理成其他的格式呢?谢谢

jklj077 commented 6 months ago

In summary, there are three prevalent data formats in use:

  1. Single-turn conversations presented as a tuple containing (instruction, input, output).
  2. Single-turn exchanges represented by an (input, output) pair, where instructions are embedded within the input.
  3. Multi-turn dialogues expressed as a series of (input, output) pairs.

简而言之,存在三种常用的数据格式:

  1. 单轮对话以包含(指令、输入、输出)的元组形式展现。
  2. 单轮交互以(输入、输出)对的形式表示,其中指令嵌入在输入中。
  3. 多轮对话则用一系列(输入、输出)对来表达。

All these formats can be readily converted to the format specified in the project's README file.

所有这些格式均可以轻松转换为本项目README文件中指定的格式。

Regarding finetuning, there is no mention in this repository of alternative formats for single-turn instructions. The finetune.py script employs a fixed data format, and the resulting finetuned model also adopts a consistent format.

关于微调,本仓库中并未提及针对单轮指令的其他格式。finetune.py脚本采用固定的数据格式,并且经过微调后的模型输出也遵循一致的格式。

For more detailed examples that align with the requirements of finetune.py in this repository, please refer to the following documentation: https://github.com/QwenLM/Qwen/blob/main/recipes/finetune/deepspeed/readme.md.

若要了解更多与本GitHub仓库中finetune.py脚本要求相符的具体示例,请参阅以下文档:https://github.com/QwenLM/Qwen/blob/main/recipes/finetune/deepspeed/readme.md

yjdy commented 6 months ago

单轮指令是整理成这种格式对吗?数据文件保存一个json list, 每个item是一个dict,key分别是instruction、input和output [ { "instruction": "保持健康的三个提示。", "input": "", "output": "以下是保持健康的三个提示:\n\n1. 保持身体活动。每天做适当的身体运动,如散步、跑步或游泳,能促进心血管健康,增强肌肉力量,并有助于减少体重。\n\n2. 均衡饮食。每天食用新鲜的蔬菜、水果、全谷物和脂肪含量低的蛋白质食物,避免高糖、高脂肪和加工食品,以保持健康的饮食习惯。\n\n3. 睡眠充足。睡眠对人体健康至关重要,成年人每天应保证 7-8 小时的睡眠。良好的睡眠有助于减轻压力,促进身体恢复,并提高注意力和记忆力。" }, { "instruction": "三原色是什么?", "input": "", "output": "三原色通常指的是红色、绿色和蓝色(RGB)。它们是通过加色混合原理创建色彩的三种基础颜色。在以发光为基础的显示设备中(如电视、计算机显示器、智能手机和平板电脑显示屏), 三原色可混合产生大量色彩。其中红色和绿色可以混合生成黄色,红色和蓝色可以混合生成品红色,蓝色和绿色可以混合生成青色。当红色、绿色和蓝色按相等比例混合时,可以产生白色或灰色。\n\n此外,在印刷和绘画中,三原色指的是以颜料为基础的红、黄和蓝颜色(RYB)。这三种颜色用以通过减色混合原理来创建色彩。不过,三原色的具体定义并不唯一,不同的颜色系统可能会采用不同的三原色。" } ]

jklj077 commented 6 months ago

Please use the format specified in the README. There are examples.

请使用README中指定的格式,样例都在那里。