x0001 commited on
Commit
28bdc18
0 Parent(s):

Duplicate from localmodels/LLM

Browse files
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ duplicated_from: localmodels/LLM
3
+ ---
4
+ # WizardCoder 15B 1.0 GPTQ
5
+
6
+ From: https://huggingface.co/WizardLM/WizardCoder-15B-V1.0
7
+
8
+ ---
9
+
10
+ ## Prompt template
11
+
12
+ ```
13
+ Below is an instruction that describes a task. Write a response that appropriately completes the request
14
+
15
+ ### Instruction: prompt
16
+
17
+ ### Response:
18
+ ```
19
+
20
+ ---
21
+
22
+ ## Model
23
+
24
+ * gptq_model-4bit--1g.safetensors
25
+ * Works with AutoGPTQ in CUDA or Triton modes.
26
+ * Does not work with GPTQ-for-LLaMa.
27
+ * Parameters: Groupsize = -1. --act-order.
28
+
29
+ ---
30
+
31
+ # WizardCoder: Empowering Code Large Language Models with Evol-Instruct
32
+
33
+
34
+ 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.
35
+
36
+ ## News
37
+
38
+ - 🔥 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.
39
+ - 🔥 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]().
40
+ - 📣 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.
41
+
42
+
43
+ ## Comparing WizardCoder with the Closed-Source Models.
44
+
45
+
46
+ 🔥 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.
47
+
48
+ <p align="center" width="100%">
49
+ <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>
50
+ </p>
51
+
52
+ ❗**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).**
53
+
54
+ ## Comparing WizardCoder with the Open-Source Models.
55
+
56
+ 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.**
57
+
58
+
59
+ | Model | HumanEval Pass@1 | MBPP Pass@1 |
60
+ |------------------|------------------|-------------|
61
+ | CodeGen-16B-Multi| 18.3 |20.9 |
62
+ | CodeGeeX | 22.9 |24.4 |
63
+ | LLaMA-33B | 21.7 |30.2 |
64
+ | LLaMA-65B | 23.7 |37.7 |
65
+ | PaLM-540B | 26.2 |36.8 |
66
+ | PaLM-Coder-540B | 36.0 |47.0 |
67
+ | PaLM 2-S | 37.6 |50.0 |
68
+ | CodeGen-16B-Mono | 29.3 |35.3 |
69
+ | Code-Cushman-001 | 33.5 |45.9 |
70
+ | StarCoder-15B | 33.6 |43.6* |
71
+ | InstructCodeT5+ | 35.0 |-- |
72
+ | WizardLM-30B 1.0| 37.8 |-- |
73
+ | WizardCoder-15B 1.0 | **57.3** |**51.8** |
74
+
75
+
76
+ ❗**Note: The reproduced result of StarCoder on MBPP.**
77
+
78
+ ❗**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).**
79
+
80
+ ## Call for Feedbacks
81
+ 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.
82
+
83
+ ## Fine-tuning
84
+
85
+ We fine-tune WizardCoder using the modified code `train.py` from [Llama-X](https://github.com/AetherCortex/Llama-X).
86
+ We fine-tune StarCoder-15B with the following hyperparameters:
87
+
88
+ | Hyperparameter | StarCoder-15B |
89
+ |----------------|---------------|
90
+ | Batch size | 512 |
91
+ | Learning rate | 2e-5 |
92
+ | Epochs | 3 |
93
+ | Max length | 2048 |
94
+ | Warmup step | 30 |
95
+ | LR scheduler | cosine |
96
+
97
+ To reproduce our fine-tuning of WizardCoder, please follow the following steps:
98
+ 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`)
99
+ 2. Replace the `train.py` with the `train_wizardcoder.py` in our repo (`src/train_wizardcoder.py`)
100
+ 3. Login Huggingface:
101
+ ```bash
102
+ huggingface-cli login
103
+ ```
104
+ 4. Execute the following training command:
105
+ ```bash
106
+ deepspeed train_wizardcoder.py \
107
+ --model_name_or_path "bigcode/starcoder" \
108
+ --data_path "/your/path/to/code_instruction_data.json" \
109
+ --output_dir "/your/path/to/ckpt" \
110
+ --num_train_epochs 3 \
111
+ --model_max_length 2048 \
112
+ --per_device_train_batch_size 16 \
113
+ --per_device_eval_batch_size 1 \
114
+ --gradient_accumulation_steps 4 \
115
+ --evaluation_strategy "no" \
116
+ --save_strategy "steps" \
117
+ --save_steps 50 \
118
+ --save_total_limit 2 \
119
+ --learning_rate 2e-5 \
120
+ --warmup_steps 30 \
121
+ --logging_steps 2 \
122
+ --lr_scheduler_type "cosine" \
123
+ --report_to "tensorboard" \
124
+ --gradient_checkpointing True \
125
+ --deepspeed configs/deepspeed_config.json \
126
+ --fp16 True
127
+ ```
128
+
129
+ ## Inference
130
+
131
+ 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.
132
+
133
+ 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.
134
+
135
+ ```bash
136
+ pip install jsonlines
137
+ ```
138
+
139
+ The decoding command is:
140
+ ```
141
+ python src\inference_wizardcoder.py \
142
+ --base_model "/your/path/to/ckpt" \
143
+ --input_data_path "/your/path/to/input/data.jsonl" \
144
+ --output_data_path "/your/path/to/output/result.jsonl"
145
+ ```
146
+
147
+ The format of `data.jsonl` should be:
148
+ ```
149
+ {"idx": 11, "Instruction": "Write a Python code to count 1 to 10."}
150
+ {"idx": 12, "Instruction": "Write a Jave code to sum 1 to 10."}
151
+ ```
152
+
153
+ The prompt for our WizardCoder in `src\inference_wizardcoder.py` is:
154
+ ```
155
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
156
+
157
+ ### Instruction:
158
+ {instruction}
159
+
160
+ ### Response:
161
+ ```
162
+
163
+ ## Evaluation
164
+
165
+ We provide the evaluation script on HumanEval for WizardCoder.
166
+
167
+ 1. According to the instructions of [HumanEval](https://github.com/openai/human-eval), install the environment.
168
+ 2. Run the following script to generate the answer.
169
+ ```bash
170
+ model="/path/to/your/model"
171
+ temp=0.2
172
+ max_len=2048
173
+ pred_num=200
174
+ num_seqs_per_iter=2
175
+
176
+ output_path=preds/T${temp}_N${pred_num}
177
+
178
+ mkdir -p ${output_path}
179
+ echo 'Output path: '$output_path
180
+ echo 'Model to eval: '$model
181
+
182
+ # 164 problems, 21 per GPU if GPU=8
183
+ index=0
184
+ gpu_num=8
185
+ for ((i = 0; i < $gpu_num; i++)); do
186
+ start_index=$((i * 21))
187
+ end_index=$(((i + 1) * 21))
188
+
189
+ gpu=$((i))
190
+ echo 'Running process #' ${i} 'from' $start_index 'to' $end_index 'on GPU' ${gpu}
191
+ ((index++))
192
+ (
193
+ CUDA_VISIBLE_DEVICES=$gpu python humaneval_gen.py --model ${model} \
194
+ --start_index ${start_index} --end_index ${end_index} --temperature ${temp} \
195
+ --num_seqs_per_iter ${num_seqs_per_iter} --N ${pred_num} --max_len ${max_len} --output_path ${output_path}
196
+ ) &
197
+ if (($index % $gpu_num == 0)); then wait; fi
198
+ done
199
+ ```
200
+ 3. Run the post processing code `src/process_humaneval.py` to collect the code completions from all answer files.
201
+ ```bash
202
+ output_path=preds/T${temp}_N${pred_num}
203
+
204
+ echo 'Output path: '$output_path
205
+ python process_humaneval.py --path ${output_path} --out_path ${output_path}.jsonl --add_prompt
206
+
207
+ evaluate_functional_correctness ${output_path}.jsonl
208
+ ```
209
+
210
+ ## Citation
211
+
212
+ Please cite the repo if you use the data or code in this repo.
213
+
214
+ ```
215
+ @misc{luo2023wizardcoder,
216
+ title={WizardCoder: Empowering Code Large Language Models with Evol-Instruct},
217
+ 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},
218
+ year={2023},
219
+ }
220
+ ```
221
+ ## Disclaimer
222
+
223
+ 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
+ }
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/content/WizardCoder/",
3
+ "activation_function": "gelu",
4
+ "architectures": [
5
+ "GPTBigCodeForCausalLM"
6
+ ],
7
+ "attention_softmax_in_fp32": true,
8
+ "attn_pdrop": 0.1,
9
+ "bos_token_id": 0,
10
+ "embd_pdrop": 0.1,
11
+ "eos_token_id": 0,
12
+ "inference_runner": 0,
13
+ "initializer_range": 0.02,
14
+ "layer_norm_epsilon": 1e-05,
15
+ "max_batch_size": null,
16
+ "max_sequence_length": null,
17
+ "model_type": "gpt_bigcode",
18
+ "multi_query": true,
19
+ "n_embd": 6144,
20
+ "n_head": 48,
21
+ "n_inner": 24576,
22
+ "n_layer": 40,
23
+ "n_positions": 8192,
24
+ "pad_key_length": true,
25
+ "pre_allocate_kv_cache": false,
26
+ "resid_pdrop": 0.1,
27
+ "scale_attention_softmax_in_fp32": true,
28
+ "scale_attn_weights": true,
29
+ "summary_activation": null,
30
+ "summary_first_dropout": 0.1,
31
+ "summary_proj_to_labels": true,
32
+ "summary_type": "cls_index",
33
+ "summary_use_proj": true,
34
+ "torch_dtype": "float16",
35
+ "transformers_version": "4.30.0.dev0",
36
+ "use_cache": true,
37
+ "validate_runner_input": true,
38
+ "vocab_size": 49153
39
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.30.0.dev0"
6
+ }
gptq_model-4bit-128g.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4fb923dc804c2e416173fe20abc06662cbd0e99ebfb5d9df1b49b54d4ce1868
3
+ size 9198428896
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
quantize_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 4,
3
+ "group_size": 128,
4
+ "damp_percent": 0.01,
5
+ "desc_act": false,
6
+ "sym": true,
7
+ "true_sequential": true,
8
+ "model_name_or_path": null,
9
+ "model_file_base_name": null
10
+ }
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