Mediocreatmybest commited on
Commit
af09211
1 Parent(s): 9fc151b

Upload 7 files

Browse files
README.md ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigscience-openrail-m
3
+ ---
4
+
5
+ This is the Full-Weight of WizardCoder.
6
+
7
+ **Repository**: https://github.com/nlpxucan/WizardLM/tree/main/WizardCoder
8
+
9
+ **Twitter**: https://twitter.com/WizardLM_AI/status/1669109414559911937
10
+
11
+ **Paper**: [WizardCoder: Empowering Code Large Language Models with Evol-Instruct](https://arxiv.org/abs/2306.08568)
12
+
13
+
14
+ ## WizardLM: Empowering Large Pre-Trained Language Models to Follow Complex Instructions
15
+
16
+
17
+ <p align="center">
18
+ 🤗 <a href="https://huggingface.co/WizardLM" target="_blank">HF Repo</a> • 🐦 <a href="https://twitter.com/WizardLM_AI" target="_blank">Twitter</a> • 📃 <a href="https://arxiv.org/abs/2304.12244" target="_blank">[WizardLM]</a> • 📃 <a href="https://arxiv.org/abs/2306.08568" target="_blank">[WizardCoder]</a> <br>
19
+ </p>
20
+ <p align="center">
21
+ 👋 Join our <a href="https://discord.gg/bpmeZD7V" target="_blank">Discord</a>
22
+ </p>
23
+
24
+
25
+ <font size=4>
26
+
27
+ | <sup>Model</sup> | <sup>Checkpoint</sup> | <sup>Paper</sup> |<sup>MT-Bench</sup> | <sup>AlpacaEval</sup> | <sup>WizardEval</sup> | <sup>HumanEval</sup> | <sup>License</sup>|
28
+ | ----- |------| ---- |------|-------| ----- | ----- | ----- |
29
+ | <sup>WizardLM-13B-V1.2</sup> | <sup>🤗 <a href="https://huggingface.co/WizardLM/WizardLM-13B-V1.2" target="_blank">HF Link</a> </sup>| | <sup>7.06</sup> | <sup>89.17%</sup> | <sup>101.4% </sup>|<sup>36.6 pass@1</sup>|<sup> <a href="https://ai.meta.com/resources/models-and-libraries/llama-downloads/" target="_blank">Llama 2 License </a></sup> |
30
+ | <sup>WizardLM-13B-V1.1</sup> |<sup> 🤗 <a href="https://huggingface.co/WizardLM/WizardLM-13B-V1.1" target="_blank">HF Link</a> </sup> | | <sup>6.76</sup> |<sup>86.32%</sup> | <sup>99.3% </sup> |<sup>25.0 pass@1</sup>| <sup>Non-commercial</sup>|
31
+ | <sup>WizardLM-30B-V1.0</sup> | <sup>🤗 <a href="https://huggingface.co/WizardLM/WizardLM-30B-V1.0" target="_blank">HF Link</a></sup> | | <sup>7.01</sup> | | <sup>97.8% </sup> | <sup>37.8 pass@1</sup>| <sup>Non-commercial</sup> |
32
+ | <sup>WizardLM-13B-V1.0</sup> | <sup>🤗 <a href="https://huggingface.co/WizardLM/WizardLM-13B-V1.0" target="_blank">HF Link</a> </sup> | | <sup>6.35</sup> | <sup>75.31%</sup> | <sup>89.1% </sup> |<sup> 24.0 pass@1 </sup> | <sup>Non-commercial</sup>|
33
+ | <sup>WizardLM-7B-V1.0 </sup>| <sup>🤗 <a href="https://huggingface.co/WizardLM/WizardLM-7B-V1.0" target="_blank">HF Link</a> </sup> |<sup> 📃 <a href="https://arxiv.org/abs/2304.12244" target="_blank">[WizardLM]</a> </sup>| | | <sup>78.0% </sup> |<sup>19.1 pass@1 </sup>|<sup> Non-commercial</sup>|
34
+ | <sup>WizardCoder-15B-V1.0</sup> | <sup> 🤗 <a href="https://huggingface.co/WizardLM/WizardCoder-15B-V1.0" target="_blank">HF Link</a></sup> | <sup>📃 <a href="https://arxiv.org/abs/2306.08568" target="_blank">[WizardCoder]</a></sup> | || |<sup> 57.3 pass@1 </sup> | <sup> <a href="https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement" target="_blank">OpenRAIL-M</a></sup> |
35
+ </font>
36
+
37
+
38
+
39
+
40
+
41
+ # WizardCoder: Empowering Code Large Language Models with Evol-Instruct
42
+
43
+
44
+ To develop our WizardCoder model, we begin by adapting the Evol-Instruct method specifically for coding tasks. This involves tailoring the prompt to the domain of code-related instructions. Subsequently, we fine-tune the Code LLM, StarCoder, utilizing the newly created instruction-following training set.
45
+
46
+ ## News
47
+
48
+ - 🔥 Our **WizardCoder-15B-v1.0** model achieves the **57.3 pass@1** on the [HumanEval Benchmarks](https://github.com/openai/human-eval), which is **22.3** points higher than the SOTA open-source Code LLMs.
49
+ - 🔥 We released **WizardCoder-15B-v1.0** trained with **78k** evolved code instructions. Please checkout the [Model Weights](https://huggingface.co/WizardLM/WizardCoder-15B-V1.0), and [Paper]().
50
+ - &#x1F4E3; Please refer to our Twitter account https://twitter.com/WizardLM_AI and HuggingFace Repo https://huggingface.co/WizardLM . We will use them to announce any new release at the 1st time.
51
+
52
+
53
+ ## Comparing WizardCoder with the Closed-Source Models.
54
+
55
+
56
+ 🔥 The following figure shows that our **WizardCoder attains the third position in this benchmark**, surpassing Claude-Plus (59.8 vs. 53.0) and Bard (59.8 vs. 44.5). Notably, our model exhibits a substantially smaller size compared to these models.
57
+
58
+ <p align="center" width="100%">
59
+ <a ><img src="https://raw.githubusercontent.com/nlpxucan/WizardLM/main/WizardCoder/imgs/pass1.png" alt="WizardCoder" style="width: 86%; min-width: 300px; display: block; margin: auto;"></a>
60
+ </p>
61
+
62
+ ❗**Note: In this study, we copy the scores for HumanEval and HumanEval+ from the [LLM-Humaneval-Benchmarks](https://github.com/my-other-github-account/llm-humaneval-benchmarks). Notably, all the mentioned models generate code solutions for each problem utilizing a **single attempt**, and the resulting pass rate percentage is reported. Our **WizardCoder** generates answers using greedy decoding and tests with the same [code](https://github.com/evalplus/evalplus).**
63
+
64
+ ## Comparing WizardCoder with the Open-Source Models.
65
+
66
+ The following table clearly demonstrates that our **WizardCoder** exhibits a substantial performance advantage over all the open-source models. ❗**If you are confused with the different scores of our model (57.3 and 59.8), please check the Notes.**
67
+
68
+
69
+ | Model | HumanEval Pass@1 | MBPP Pass@1 |
70
+ |------------------|------------------|-------------|
71
+ | CodeGen-16B-Multi| 18.3 |20.9 |
72
+ | CodeGeeX | 22.9 |24.4 |
73
+ | LLaMA-33B | 21.7 |30.2 |
74
+ | LLaMA-65B | 23.7 |37.7 |
75
+ | PaLM-540B | 26.2 |36.8 |
76
+ | PaLM-Coder-540B | 36.0 |47.0 |
77
+ | PaLM 2-S | 37.6 |50.0 |
78
+ | CodeGen-16B-Mono | 29.3 |35.3 |
79
+ | Code-Cushman-001 | 33.5 |45.9 |
80
+ | StarCoder-15B | 33.6 |43.6* |
81
+ | InstructCodeT5+ | 35.0 |-- |
82
+ | WizardLM-30B 1.0| 37.8 |-- |
83
+ | WizardCoder-15B 1.0 | **57.3** |**51.8** |
84
+
85
+
86
+ ❗**Note: The reproduced result of StarCoder on MBPP.**
87
+
88
+ ❗**Note: The above table conducts a comprehensive comparison of our **WizardCoder** with other models on the HumanEval and MBPP benchmarks. We adhere to the approach outlined in previous studies by generating **20 samples** for each problem to estimate the pass@1 score and evaluate with the same [code](https://github.com/openai/human-eval/tree/master). The scores of GPT4 and GPT3.5 reported by [OpenAI](https://openai.com/research/gpt-4) are 67.0 and 48.1 (maybe these are the early version GPT4&3.5).**
89
+
90
+ ## Call for Feedbacks
91
+ We welcome everyone to use your professional and difficult instructions to evaluate WizardCoder, and show us examples of poor performance and your suggestions in the [issue discussion](https://github.com/nlpxucan/WizardLM/issues) area. We are focusing on improving the Evol-Instruct now and hope to relieve existing weaknesses and issues in the the next version of WizardCoder. After that, we will open the code and pipeline of up-to-date Evol-Instruct algorithm and work with you together to improve it.
92
+
93
+
94
+ ## Contents
95
+
96
+ 1. [Online Demo](#online-demo)
97
+
98
+ 2. [Fine-tuning](#fine-tuning)
99
+
100
+ 3. [Inference](#inference)
101
+
102
+ 4. [Evaluation](#evaluation)
103
+
104
+ 5. [Citation](#citation)
105
+
106
+ 6. [Disclaimer](#disclaimer)
107
+
108
+ ## Online Demo
109
+
110
+ We will provide our latest models for you to try for as long as possible. If you find a link is not working, please try another one. At the same time, please try as many **real-world** and **challenging** code-related problems that you encounter in your work and life as possible. We will continue to evolve our models with your feedbacks.
111
+
112
+
113
+
114
+ ## Fine-tuning
115
+
116
+ We fine-tune WizardCoder using the modified code `train.py` from [Llama-X](https://github.com/AetherCortex/Llama-X).
117
+ We fine-tune StarCoder-15B with the following hyperparameters:
118
+
119
+ | Hyperparameter | StarCoder-15B |
120
+ |----------------|---------------|
121
+ | Batch size | 512 |
122
+ | Learning rate | 2e-5 |
123
+ | Epochs | 3 |
124
+ | Max length | 2048 |
125
+ | Warmup step | 30 |
126
+ | LR scheduler | cosine |
127
+
128
+ To reproduce our fine-tuning of WizardCoder, please follow the following steps:
129
+ 1. According to the instructions of [Llama-X](https://github.com/AetherCortex/Llama-X), install the environment, download the training code, and deploy. (Note: `deepspeed==0.9.2` and `transformers==4.29.2`)
130
+ 2. Replace the `train.py` with the `train_wizardcoder.py` in our repo (`src/train_wizardcoder.py`)
131
+ 3. Login Huggingface:
132
+ ```bash
133
+ huggingface-cli login
134
+ ```
135
+ 4. Execute the following training command:
136
+ ```bash
137
+ deepspeed train_wizardcoder.py \
138
+ --model_name_or_path "bigcode/starcoder" \
139
+ --data_path "/your/path/to/code_instruction_data.json" \
140
+ --output_dir "/your/path/to/ckpt" \
141
+ --num_train_epochs 3 \
142
+ --model_max_length 2048 \
143
+ --per_device_train_batch_size 16 \
144
+ --per_device_eval_batch_size 1 \
145
+ --gradient_accumulation_steps 4 \
146
+ --evaluation_strategy "no" \
147
+ --save_strategy "steps" \
148
+ --save_steps 50 \
149
+ --save_total_limit 2 \
150
+ --learning_rate 2e-5 \
151
+ --warmup_steps 30 \
152
+ --logging_steps 2 \
153
+ --lr_scheduler_type "cosine" \
154
+ --report_to "tensorboard" \
155
+ --gradient_checkpointing True \
156
+ --deepspeed configs/deepspeed_config.json \
157
+ --fp16 True
158
+ ```
159
+
160
+ ## Inference
161
+
162
+ We provide the decoding script for WizardCoder, which reads a input file and generates corresponding responses for each sample, and finally consolidates them into an output file.
163
+
164
+ You can specify `base_model`, `input_data_path` and `output_data_path` in `src\inference_wizardcoder.py` to set the decoding model, path of input file and path of output file.
165
+
166
+ ```bash
167
+ pip install jsonlines
168
+ ```
169
+
170
+ The decoding command is:
171
+ ```
172
+ python src\inference_wizardcoder.py \
173
+ --base_model "/your/path/to/ckpt" \
174
+ --input_data_path "/your/path/to/input/data.jsonl" \
175
+ --output_data_path "/your/path/to/output/result.jsonl"
176
+ ```
177
+
178
+ The format of `data.jsonl` should be:
179
+ ```
180
+ {"idx": 11, "Instruction": "Write a Python code to count 1 to 10."}
181
+ {"idx": 12, "Instruction": "Write a Jave code to sum 1 to 10."}
182
+ ```
183
+
184
+ The prompt for our WizardCoder in `src\inference_wizardcoder.py` is:
185
+ ```
186
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
187
+
188
+ ### Instruction:
189
+ {instruction}
190
+
191
+ ### Response:
192
+ ```
193
+
194
+ ## Evaluation
195
+
196
+ We provide the evaluation script on HumanEval for WizardCoder.
197
+
198
+ 1. According to the instructions of [HumanEval](https://github.com/openai/human-eval), install the environment.
199
+ 2. Run the following script to generate the answer.
200
+ ```bash
201
+ model="/path/to/your/model"
202
+ temp=0.2
203
+ max_len=2048
204
+ pred_num=200
205
+ num_seqs_per_iter=2
206
+
207
+ output_path=preds/T${temp}_N${pred_num}
208
+
209
+ mkdir -p ${output_path}
210
+ echo 'Output path: '$output_path
211
+ echo 'Model to eval: '$model
212
+
213
+ # 164 problems, 21 per GPU if GPU=8
214
+ index=0
215
+ gpu_num=8
216
+ for ((i = 0; i < $gpu_num; i++)); do
217
+ start_index=$((i * 21))
218
+ end_index=$(((i + 1) * 21))
219
+
220
+ gpu=$((i))
221
+ echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu}
222
+ ((index++))
223
+ (
224
+ CUDA_VISIBLE_DEVICES=$gpu python humaneval_gen.py --model ${model} \
225
+ --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
226
+ --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path}
227
+ ) &
228
+ if (($index % $gpu_num == 0)); then wait; fi
229
+ done
230
+ ```
231
+ 3. Run the post processing code `src/process_humaneval.py` to collect the code completions from all answer files.
232
+ ```bash
233
+ output_path=preds/T${temp}_N${pred_num}
234
+
235
+ echo 'Output path: '$output_path
236
+ python process_humaneval.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
237
+
238
+ evaluate_functional_correctness ${output_path}.jsonl
239
+ ```
240
+
241
+ ## Citation
242
+
243
+ Please cite the repo if you use the data or code in this repo.
244
+
245
+ ```
246
+ @misc{luo2023wizardcoder,
247
+ title={WizardCoder: Empowering Code Large Language Models with Evol-Instruct},
248
+ author={Ziyang Luo and Can Xu and Pu Zhao and Qingfeng Sun and Xiubo Geng and Wenxiang Hu and Chongyang Tao and Jing Ma and Qingwei Lin and Daxin Jiang},
249
+ year={2023},
250
+ }
251
+ ```
252
+ ## Disclaimer
253
+
254
+ The resources, including code, data, and model weights, associated with this project are restricted for academic research purposes only and cannot be used for commercial purposes. The content produced by any version of WizardCoder is influenced by uncontrollable variables such as randomness, and therefore, the accuracy of the output cannot be guaranteed by this project. This project does not accept any legal liability for the content of the model output, nor does it assume responsibility for any losses incurred due to the use of associated resources and output results.
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "[PAD]": 49152
3
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "<fim_prefix>",
5
+ "<fim_middle>",
6
+ "<fim_suffix>",
7
+ "<fim_pad>",
8
+ "<filename>",
9
+ "<gh_stars>",
10
+ "<issue_start>",
11
+ "<issue_comment>",
12
+ "<issue_closed>",
13
+ "<jupyter_start>",
14
+ "<jupyter_text>",
15
+ "<jupyter_code>",
16
+ "<jupyter_output>",
17
+ "<empty_output>",
18
+ "<commit_before>",
19
+ "<commit_msg>",
20
+ "<commit_after>",
21
+ "<reponame>"
22
+ ],
23
+ "bos_token": "<|endoftext|>",
24
+ "eos_token": "<|endoftext|>",
25
+ "pad_token": "[PAD]",
26
+ "unk_token": "<|endoftext|>"
27
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "additional_special_tokens": [
4
+ "<|endoftext|>",
5
+ "<fim_prefix>",
6
+ "<fim_middle>",
7
+ "<fim_suffix>",
8
+ "<fim_pad>",
9
+ "<filename>",
10
+ "<gh_stars>",
11
+ "<issue_start>",
12
+ "<issue_comment>",
13
+ "<issue_closed>",
14
+ "<jupyter_start>",
15
+ "<jupyter_text>",
16
+ "<jupyter_code>",
17
+ "<jupyter_output>",
18
+ "<empty_output>",
19
+ "<commit_before>",
20
+ "<commit_msg>",
21
+ "<commit_after>",
22
+ "<reponame>"
23
+ ],
24
+ "bos_token": "<|endoftext|>",
25
+ "clean_up_tokenization_spaces": true,
26
+ "eos_token": "<|endoftext|>",
27
+ "model_max_length": 2048,
28
+ "padding_side": "right",
29
+ "tokenizer_class": "GPT2Tokenizer",
30
+ "unk_token": "<|endoftext|>",
31
+ "vocab_size": 49152
32
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff