🚀 开源指令代码羊驼7B模型
本模型是在代码羊驼(Code Alpaca)数据集上微调的70亿参数羊驼(LLaMa)模型。请注意,这是一个模型差异文件(model diff),使用说明见下文。
该模型是论文 骆驼能走多远?探索开放资源上指令微调的现状 研究的一部分。用于训练和评估此模型的代码库可在 https://github.com/allenai/open-instruct 找到。
本模型遵循 LICENSE.txt
中给出的人工智能模型许可证以及原始羊驼许可证(llama_license.txt
)。
🚀 快速开始
✨ 主要特性
- 基于70亿参数的羊驼模型微调,在代码相关任务上有较好表现。
- 遵循特定的输入格式,能更好地生成响应。
📦 安装指南
我们假设你已经可以访问HF格式的羊驼模型。你可以在以下链接找到获取访问权限和转换模型的详细信息:
https://huggingface.co/docs/transformers/main/model_doc/llama
克隆 https://github.com/allenai/open-instruct 仓库并安装所需依赖,或者仅复制 scripts/weight_diff.py
文件并安装 weight-diff-requirements.txt
中列出的最小依赖项。然后将此模型差异文件下载或克隆到同一台机器上。
💻 使用示例
基础用法
运行以下命令来恢复模型:
python scripts/weight_diff.py recover --path_raw ${hf_llama_path} --path_tuned ${output_path} --path_diff ${diff_location}
运行上述命令后,你将得到一个恢复后的模型!请注意,这会占用相当多的内存,尤其是对于较大的模型。
📚 详细文档
输入格式
模型训练时使用以下格式(注意换行符):
<|user|>
Your message here!
<|assistant|>
为获得最佳效果,请以这种方式格式化所有输入。
性能表现
以下是该模型在论文 骆驼能走多远?探索开放资源上指令微调的现状 所探索的各项基准测试中的性能表现:
属性 |
详情 |
MMLU零样本 |
34.7 |
MMLU五样本 |
34.5 |
GSM直接 |
6.5 |
GSM思维链 |
7.5 |
BBH直接 |
29.6 |
BBH思维链 |
30.5 |
TydiQA黄金段落 |
36.7 |
TydiQA闭卷 |
10.5 |
Codex-Eval通过率@1 |
16.5 |
Codex-Eval通过率@10 |
29.2 |
AlpacaFarm对比Davinci-003 |
17.5 |
平均 |
22.6 |
📄 许可证
本模型遵循 LICENSE.txt
中给出的人工智能模型许可证以及原始羊驼许可证(llama_license.txt
)。
引用说明
如果你使用此模型,请引用我们的论文、羊驼论文以及原始数据集:
@misc{wang2023far,
title={How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources},
author={Yizhong Wang and Hamish Ivison and Pradeep Dasigi and Jack Hessel and Tushar Khot and Khyathi Raghavi Chandu and David Wadden and Kelsey MacMillan and Noah A. Smith and Iz Beltagy and Hannaneh Hajishirzi},
year={2023},
eprint={2306.04751},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{touvron2023llama,
title={LLaMA: Open and Efficient Foundation Language Models},
author={Hugo Touvron and Thibaut Lavril and Gautier Izacard and Xavier Martinet and Marie-Anne Lachaux and Timothée Lacroix and Baptiste Rozière and Naman Goyal and Eric Hambro and Faisal Azhar and Aurelien Rodriguez and Armand Joulin and Edouard Grave and Guillaume Lample},
year={2023},
eprint={2302.13971},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{codealpaca,
author = {Sahil Chaudhary},
title = {Code Alpaca: An Instruction-following LLaMA model for code generation},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/sahil280114/codealpaca}},
}