LoupGarou commited on
Commit
394f449
1 Parent(s): 1ae92c0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +65 -231
README.md CHANGED
@@ -1,231 +1,65 @@
1
- ---
2
- license: bigcode-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
-
15
-
16
-
17
- # WizardCoder: Empowering Code Large Language Models with Evol-Instruct
18
-
19
-
20
- 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.
21
-
22
- ## News
23
-
24
- - 🔥 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.
25
- - 🔥 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]().
26
- - 📣 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.
27
-
28
-
29
- ## Comparing WizardCoder with the Closed-Source Models.
30
-
31
-
32
- 🔥 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.
33
-
34
- <p align="center" width="100%">
35
- <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>
36
- </p>
37
-
38
- ❗**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).**
39
-
40
- ## Comparing WizardCoder with the Open-Source Models.
41
-
42
- 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.**
43
-
44
-
45
- | Model | HumanEval Pass@1 | MBPP Pass@1 |
46
- |------------------|------------------|-------------|
47
- | CodeGen-16B-Multi| 18.3 |20.9 |
48
- | CodeGeeX | 22.9 |24.4 |
49
- | LLaMA-33B | 21.7 |30.2 |
50
- | LLaMA-65B | 23.7 |37.7 |
51
- | PaLM-540B | 26.2 |36.8 |
52
- | PaLM-Coder-540B | 36.0 |47.0 |
53
- | PaLM 2-S | 37.6 |50.0 |
54
- | CodeGen-16B-Mono | 29.3 |35.3 |
55
- | Code-Cushman-001 | 33.5 |45.9 |
56
- | StarCoder-15B | 33.6 |43.6* |
57
- | InstructCodeT5+ | 35.0 |-- |
58
- | WizardLM-30B 1.0| 37.8 |-- |
59
- | WizardCoder-15B 1.0 | **57.3** |**51.8** |
60
-
61
-
62
- ❗**Note: The reproduced result of StarCoder on MBPP.**
63
-
64
- ❗**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).**
65
-
66
- ## Call for Feedbacks
67
- 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.
68
-
69
-
70
- ## Contents
71
-
72
- 1. [Online Demo](#online-demo)
73
-
74
- 2. [Fine-tuning](#fine-tuning)
75
-
76
- 3. [Inference](#inference)
77
-
78
- 4. [Evaluation](#evaluation)
79
-
80
- 5. [Citation](#citation)
81
-
82
- 6. [Disclaimer](#disclaimer)
83
-
84
- ## Online Demo
85
-
86
- 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.
87
-
88
-
89
-
90
- ## Fine-tuning
91
-
92
- We fine-tune WizardCoder using the modified code `train.py` from [Llama-X](https://github.com/AetherCortex/Llama-X).
93
- We fine-tune StarCoder-15B with the following hyperparameters:
94
-
95
- | Hyperparameter | StarCoder-15B |
96
- |----------------|---------------|
97
- | Batch size | 512 |
98
- | Learning rate | 2e-5 |
99
- | Epochs | 3 |
100
- | Max length | 2048 |
101
- | Warmup step | 30 |
102
- | LR scheduler | cosine |
103
-
104
- To reproduce our fine-tuning of WizardCoder, please follow the following steps:
105
- 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`)
106
- 2. Replace the `train.py` with the `train_wizardcoder.py` in our repo (`src/train_wizardcoder.py`)
107
- 3. Login Huggingface:
108
- ```bash
109
- huggingface-cli login
110
- ```
111
- 4. Execute the following training command:
112
- ```bash
113
- deepspeed train_wizardcoder.py \
114
- --model_name_or_path "bigcode/starcoder" \
115
- --data_path "/your/path/to/code_instruction_data.json" \
116
- --output_dir "/your/path/to/ckpt" \
117
- --num_train_epochs 3 \
118
- --model_max_length 2048 \
119
- --per_device_train_batch_size 16 \
120
- --per_device_eval_batch_size 1 \
121
- --gradient_accumulation_steps 4 \
122
- --evaluation_strategy "no" \
123
- --save_strategy "steps" \
124
- --save_steps 50 \
125
- --save_total_limit 2 \
126
- --learning_rate 2e-5 \
127
- --warmup_steps 30 \
128
- --logging_steps 2 \
129
- --lr_scheduler_type "cosine" \
130
- --report_to "tensorboard" \
131
- --gradient_checkpointing True \
132
- --deepspeed configs/deepspeed_config.json \
133
- --fp16 True
134
- ```
135
-
136
- ## Inference
137
-
138
- 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.
139
-
140
- 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.
141
-
142
- ```bash
143
- pip install jsonlines
144
- ```
145
-
146
- The decoding command is:
147
- ```
148
- python src\inference_wizardcoder.py \
149
- --base_model "/your/path/to/ckpt" \
150
- --input_data_path "/your/path/to/input/data.jsonl" \
151
- --output_data_path "/your/path/to/output/result.jsonl"
152
- ```
153
-
154
- The format of `data.jsonl` should be:
155
- ```
156
- {"idx": 11, "Instruction": "Write a Python code to count 1 to 10."}
157
- {"idx": 12, "Instruction": "Write a Jave code to sum 1 to 10."}
158
- ```
159
-
160
- The prompt for our WizardCoder in `src\inference_wizardcoder.py` is:
161
- ```
162
- Below is an instruction that describes a task. Write a response that appropriately completes the request.
163
-
164
- ### Instruction:
165
- {instruction}
166
-
167
- ### Response:
168
- ```
169
-
170
- ## Evaluation
171
-
172
- We provide the evaluation script on HumanEval for WizardCoder.
173
-
174
- 1. According to the instructions of [HumanEval](https://github.com/openai/human-eval), install the environment.
175
- 2. Run the following script to generate the answer.
176
- ```bash
177
- model="/path/to/your/model"
178
- temp=0.2
179
- max_len=2048
180
- pred_num=200
181
- num_seqs_per_iter=2
182
-
183
- output_path=preds/T${temp}_N${pred_num}
184
-
185
- mkdir -p ${output_path}
186
- echo 'Output path: '$output_path
187
- echo 'Model to eval: '$model
188
-
189
- # 164 problems, 21 per GPU if GPU=8
190
- index=0
191
- gpu_num=8
192
- for ((i = 0; i < $gpu_num; i++)); do
193
- start_index=$((i * 21))
194
- end_index=$(((i + 1) * 21))
195
-
196
- gpu=$((i))
197
- echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu}
198
- ((index++))
199
- (
200
- CUDA_VISIBLE_DEVICES=$gpu python humaneval_gen.py --model ${model} \
201
- --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
202
- --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path}
203
- ) &
204
- if (($index % $gpu_num == 0)); then wait; fi
205
- done
206
- ```
207
- 3. Run the post processing code `src/process_humaneval.py` to collect the code completions from all answer files.
208
- ```bash
209
- output_path=preds/T${temp}_N${pred_num}
210
-
211
- echo 'Output path: '$output_path
212
- python process_humaneval.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
213
-
214
- evaluate_functional_correctness ${output_path}.jsonl
215
- ```
216
-
217
- ## Citation
218
-
219
- Please cite the repo if you use the data or code in this repo.
220
-
221
- ```
222
- @misc{luo2023wizardcoder,
223
- title={WizardCoder: Empowering Code Large Language Models with Evol-Instruct},
224
- 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},
225
- year={2023},
226
- }
227
- ```
228
- ## Disclaimer
229
-
230
- 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.
231
-
 
1
+ WizardGuanaco-V1.0 Model Card
2
+ The WizardCoder-Guanaco-15B-V1.0 is a language model that combines the strengths of the WizardCoder base model and the Guanaco finetuning dataset. The Guanaco dataset is trimmed to within 2 standard deviations of token size for input and output pairs and all non-english data has been removed to reduce training size requirements.
3
+
4
+ Model Description
5
+ This model is built on top of the WizardCoder base model, a large language model known for its impressive capabilities in code related instruction. The WizardCoder base model was further finetuned using QLORA on the Guanaco dataset to enhance its generative abilities.
6
+
7
+ However, to ensure more targeted learning and data processing, the Guanaco dataset was trimmed to within 2 standard deviations of token size for question sets. This process enhances the model's ability to generate more precise and relevant answers, eliminating outliers that could potentially distort the responses. In addition, to focus on English language proficiency, all non-English data has been removed from the Guanaco dataset.
8
+
9
+ Intended Use
10
+ This model is designed to be used for a wide array of text generation tasks that require understanding and generating English text. The model is expected to perform well in tasks such as answering questions, writing essays, summarizing text, translation, and more. However, given the specific data processing and finetuning done, it might be particularly effective for tasks related to English language question-answering systems.
11
+
12
+ Limitations
13
+ Despite the powerful capabilities of this model, users should be aware of its limitations. The model's knowledge is up to date only until the time it was trained, and it doesn't know about events in the world after that. It can sometimes produce incorrect or nonsensical responses, as it doesn't understand the text in the same way humans do. It should be used as a tool to assist in generating text and not as a sole source of truth.
14
+
15
+ How to use
16
+ Here is an example of how to use this model:
17
+
18
+ from transformers import AutoModelForCausalLM, AutoTokenizer
19
+ import time
20
+ import torch
21
+
22
+ class Chatbot:
23
+ def __init__(self, model_name):
24
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side='left')
25
+ self.model = AutoModelForCausalLM.from_pretrained(model_name,
26
+ load_in_4bit=True,
27
+ torch_dtype=torch.bfloat16)
28
+ if self.tokenizer.pad_token_id is None:
29
+ self.tokenizer.pad_token_id = self.tokenizer.eos_token_id
30
+
31
+ def get_response(self, prompt):
32
+ inputs = self.tokenizer.encode_plus(prompt, return_tensors="pt", padding='max_length', max_length=100)
33
+ if next(self.model.parameters()).is_cuda:
34
+ inputs = {name: tensor.to('cuda') for name, tensor in inputs.items()}
35
+ start_time = time.time()
36
+ tokens = self.model.generate(input_ids=inputs['input_ids'],
37
+ attention_mask=inputs['attention_mask'],
38
+ pad_token_id=self.tokenizer.pad_token_id,
39
+ max_new_tokens=400)
40
+ end_time = time.time()
41
+ output_tokens = tokens[0][inputs['input_ids'].shape[-1]:]
42
+ output = self.tokenizer.decode(output_tokens, skip_special_tokens=True)
43
+ time_taken = end_time - start_time
44
+ return output, time_taken
45
+
46
+ def main():
47
+ chatbot = Chatbot("LoupGarou/WizardCoder-Guanaco-15B-V1.0")
48
+ while True:
49
+ user_input = input("Enter your prompt: ")
50
+ if user_input.lower() == 'quit':
51
+ break
52
+ output, time_taken = chatbot.get_response(user_input)
53
+ print("\033[33m" + output + "\033[0m")
54
+ print("Time taken to process: ", time_taken, "seconds")
55
+ print("Exited the program.")
56
+
57
+ if __name__ == "__main__":
58
+ main()
59
+
60
+
61
+ Training Procedure
62
+ The base WizardCoder model was finetuned on the Guanaco dataset using QLORA, which was trimmed to within 2 standard deviations of token size for question sets and randomized. All non-English data was also removed from this finetuning dataset.
63
+
64
+ Acknowledgements
65
+ This model is the result of finetuning efforts based on the WizardCoder base model and the Guanaco model. Many thanks to the creators and the community around these models. Special thanks to the Hugging Face team for providing the transformers library which made this work possible.