ChatAlpaca
收藏ChatAlpaca: A Multi-Turn Dialogue Corpus based on Alpaca Instructions
数据集概述
ChatAlpaca 是一个多轮对话数据集,旨在帮助研究人员开发遵循指令的多轮对话模型。该数据集是基于 Stanford Alpaca 数据的扩展,包含多轮指令及其对应的响应。
数据内容
数据集包含一个 JSON 文件 data/chatalpaca-10k.json,其中包含多轮指令遵循对话。每个条目代表一个模拟用户和 ChatGPT 之间的不同对话。数据集目前包含总共 10,000 个对话和 95,558 个话语。
更新:我们发布了 data/chatalpaca-20k.json 数据和一个使用 Google 翻译的中文版本数据 data/chatalpaca-20k-chinese-google-translation.json。
每个对话以一个指令开始,随后是 ChatGPT 的响应,这些响应来自 Stanford Alpaca 数据。对话继续由用户提供进一步的指令,ChatGPT 相应地响应。
每个条目是一个字典列表,每个字典包含以下字段:
role:str,表示对话中的角色,可以是 "user" 或 "assistant"。content:str,对话内容。
示例数据: json [ { "role": "user", "content": "Identify the odd one out: Twitter, Instagram, Telegram" }, { "role": "assistant", "content": "Telegram" }, { "role": "user", "content": "What makes Telegram different from Twitter and Instagram?" }, { "role": "assistant", "content": "Telegram is a cloud-based instant messaging app that focuses on privacy and security. Unlike Twitter and Instagram which are mainly used for following news, celebrities, and sharing images, Telegram was created as a secure messaging app for private and group communication. Telegram also offers more advanced features than Twitter and Instagram, such as the ability to schedule messages, create bots, and send encrypted messages." }, { "role": "user", "content": "Can you give me an example of how the scheduling messages feature can be useful on Telegram?" }, { "role": "assistant", "content": "Sure! The scheduling messages feature on Telegram can be useful in many different situations. Heres an example:
Lets say you have a workgroup on Telegram, and you want to send a message to everyone in the group to remind them of a meeting. However, you know that most of the people in the group are busy at work during the time you want to send the message.
Thats where the scheduling messages feature comes in. You can schedule the message to be sent at a later time when people are more likely to be free, such as during their lunch break or after work. This way, everyone in the group will receive the message at the same time, and you wont have to worry about anyone missing the important reminder.
Overall, the scheduling messages feature can be really helpful for coordinating communication with groups of people on Telegram, whether its for work, social events, or anything else." }, { "role": "user", "content": "Goodbye." } ]
数据生成过程
数据生成过程从原始的 Stanford Alpaca 数据开始。我们使用该数据集中的指令作为对话的起点。
用户话语生成
我们使用 ChatGPT (GPT-3.5-turbo) 生成后续话语并继续对话。为此,我们向模型提供设计好的提示和当前聊天历史,并要求 ChatGPT 生成模拟用户的话语,通过进一步提问或提供提示来继续对话。
响应生成
然后,我们使用生成的用户话语作为下一轮对话的起点。ChatGPT 的响应随后被附加到聊天历史中。
模型权重
我们发布了 Chatalpaca-7b-lora 和 Chatalpaca-7B-hf 模型权重,这些模型是基于 20k 数据训练的。
微调
如果你想用自己的数据微调 LLaMA,请遵循 ./data/chatalpaca-20k.json 的格式并运行微调脚本。
代码和超参数
我们的代码基于 Fastchat 和 alpaca-lora,支持多轮聊天数据。我们使用与 Fastchat 和 alpaca-lora 类似的超参数。
全量微调
| 超参数 | 全局批量大小 | 学习率 | 训练轮数 | 最大长度 | 权重衰减 |
|---|---|---|---|---|---|
| Chatalpaca-7b-hf | 128 | 2e-5 | 6 | 2048 | 0 |
LoRA 微调
| 超参数 | 全局批量大小 | 学习率 | 训练轮数 | 最大长度 | Lora_target_modules | Lora_r |
|---|---|---|---|---|---|---|
| Chatalpaca-7b-lora | 64 | 3e-4 | 3 | 2048 | [q_proj,k_proj,v_proj,o_proj] | 16 |
部署和推理
使用以下命令将 Chatalpaca-20k 模型部署到本地服务器。 bash python utils/deploy.py --model_path /path/to/your-model --prompt_style vicuna-hf
部署后,你可以访问 localhost:7860 与模型对话。
TODO
- [x] 发布 10k 数据
- [x] 发布 20k 数据
- [x] 发布中文翻译版本数据
- [x] 发布 LLaMA-7B-LoRA 模型
- [x] 发布 LLaMA-7B 微调模型
引用
请在使用该数据集时引用此仓库。
@misc{ChatAlpaca, author = {Ning Bian and Hongyu Lin and Yaojie Lu and Xianpei Han and Le Sun and Ben He }, title = {ChatAlpaca: A Multi-Turn Dialogue Corpus based on Alpaca Instructions}, year = {2023}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {url{https://github.com/cascip/ChatAlpaca}}, }




