🚀 Open-Instruct Code Alpaca 7B
This is a 7B LLaMa model fine-tuned on the Code Alpaca dataset. Note that this is a model diff - see usage instructions below.
This model was developed as part of the research paper How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources. The codebase for training and evaluating this model is available at https://github.com/allenai/open-instruct.
This model is licensed under the AI model license specified in LICENSE.txt
, along with the original Llama license (llama_license.txt
).
🚀 Quick Start
We assume you already have access to a LLaMa model in HF format. You can find details on obtaining access and converting the model here:
https://huggingface.co/docs/transformers/main/model_doc/llama
Clone https://github.com/allenai/open-instruct and install the required dependencies, or simply copy scripts/weight_diff.py
and install the minimal requirements listed in weight-diff-requirements.txt
. Then, download or clone this model diff to the same machine.
Next, run the following command:
python scripts/weight_diff.py recover --path_raw ${hf_llama_path} --path_tuned ${output_path} --path_diff ${diff_location}
You'll then have a recovered model! Keep in mind that this process consumes a significant amount of RAM, especially for larger models.
✨ Features
Input Format
The model is trained to use the following format (note the newlines):
<|user|>
Your message here!
<|assistant|>
For optimal results, format all inputs in this way.
Performance
Here is the performance of this model across benchmarks explored in our paper How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources:
MMLU 0-shot |
MMLU 5-shot |
GSM Direct |
GSM CoT |
BBH Direct |
BBH CoT |
TydiQA Gold-Passage |
TydiQA Closed-book |
Codex-Eval Pass@1 |
Codex-Eval Pass@10 |
AlpacaFarm vs Davinci-003 |
Average |
34.7 |
34.5 |
6.5 |
7.5 |
29.6 |
30.5 |
36.7 |
10.5 |
16.5 |
29.2 |
17.5 |
22.6 |
📚 Documentation
If you use this model, please cite our work, the llama paper, and the original dataset:
@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}},
}
📄 License
This model is licensed under the AI model license given in LICENSE.txt
along with the original Llama license (llama_license.txt
).
📦 Installation
Dependencies
Clone https://github.com/allenai/open-instruct and install the required dependencies, or just copy scripts/weight_diff.py
and install the minimal requirements listed in weight-diff-requirements.txt
.
Model Recovery
After installing the dependencies and getting the model diff, run the following command:
python scripts/weight_diff.py recover --path_raw ${hf_llama_path} --path_tuned ${output_path} --path_diff ${diff_location}
💻 Usage Examples
Basic Usage
python scripts/weight_diff.py recover --path_raw ${hf_llama_path} --path_tuned ${output_path} --path_diff ${diff_location}
Input Format Example
<|user|>
Generate a Python function to add two numbers.
<|assistant|>