🚀 開源指令代碼羊駝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}},
}