TheBloke commited on
Commit
313d9f0
1 Parent(s): d44e925

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -0
README.md CHANGED
@@ -78,3 +78,204 @@ So if you're able and willing to contribute, it'd be most gratefully received an
78
  * Ko-Fi: https://ko-fi.com/TheBlokeAI
79
 
80
  # Original model card: WizardLM 13B 1.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  * Ko-Fi: https://ko-fi.com/TheBlokeAI
79
 
80
  # Original model card: WizardLM 13B 1.0
81
+
82
+ ## WizardLM: An Instruction-following LLM Using Evol-Instruct
83
+ Empowering Large Pre-Trained Language Models to Follow Complex Instructions
84
+
85
+ <p align="center" width="100%">
86
+ <a ><img src="imgs/WizardLM.png" alt="WizardLM" style="width: 20%; min-width: 300px; display: block; margin: auto;"></a>
87
+ </p>
88
+
89
+ [![Code License](https://img.shields.io/badge/Code%20License-Apache_2.0-green.svg)](https://github.com/tatsu-lab/stanford_alpaca/blob/main/LICENSE)
90
+ [![Data License](https://img.shields.io/badge/Data%20License-CC%20By%20NC%204.0-red.svg)](https://github.com/tatsu-lab/stanford_alpaca/blob/main/DATA_LICENSE)
91
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/release/python-390/)
92
+
93
+ ## News
94
+
95
+ At present, our core contributors are preparing the **33B** version and we expect to empower WizardLM with the ability to perform instruction evolution itself, aiming to evolve your specific data at a low cost.
96
+
97
+ - 🔥 We released **13B** version of **WizardLM** trained with **250k** evolved instructions (from ShareGPT). Checkout the [Demo_13B](https://a6d4f31b5a1ee33f.gradio.app/), [Demo_13B_bak](https://e79c80d2c2379e77.gradio.app) and the GPT-4 evaluation. Please download our delta model at the following [link](https://huggingface.co/victor123/WizardLM-13B-1.0).
98
+ - 🔥 We released **7B** version of **WizardLM** trained with **70k** evolved instructions (from Alpaca data). Checkout the [paper](https://arxiv.org/abs/2304.12244) and [Demo_7B](https://f195ccdce69a86d5.gradio.app) , [Demo_7B_bak](https://ce25bd0feced0f77.gradio.app)
99
+ - &#x1F4E3; We are looking for highly motivated students to join us as interns to create more intelligent AI together. Please contact caxu@microsoft.com
100
+
101
+ <!-- Although on our **complexity-balanced test set**, **WizardLM-7B has more cases that are preferred by human labelers than ChatGPT** in the high-complexity instructions (difficulty level >= 8), it still lags behind ChatGPT on the entire test set, and we also consider WizardLM to still be in a **baby state**. This repository will **continue to improve WizardLM**, train on larger scales, add more training data, and innovate more advanced large-model training methods. -->
102
+
103
+ <b>Note for 13B model usage:</b> To obtain results **identical to our demo**, please strictly follow the prompts and invocation methods provided in the **"src/infer_wizardlm13b.py"** to use our 13B model for inference. Unlike the 7B model, the 13B model adopts the prompt format from Vicuna and supports **multi-turn** conversation.
104
+
105
+ <b>Note for demo usage:</b> We only recommend using **English** to experience our model. Support for other languages will be introduced in the future. The demo currently only supports **single-turn** conversation.
106
+
107
+ ### GPT-4 automatic evaluation
108
+
109
+ We adopt the automatic evaluation framework based on GPT-4 proposed by FastChat to assess the performance of chatbot models. As shown in the following figure, WizardLM-13B achieved better results than Vicuna-13b.
110
+ <p align="center" width="100%">
111
+ <a ><img src="imgs/WizarLM13b-GPT4.png" alt="WizardLM" style="width: 100%; min-width: 300px; display: block; margin: auto;"></a>
112
+ </p>
113
+
114
+ ### WizardLM-13B performance on different skills.
115
+
116
+ The following figure compares WizardLM-13B and ChatGPT’s skill on Evol-Instruct testset. The result indicates that WizardLM-13B achieves 89.1% of ChatGPT’s performance on average, with almost 100% (or more than) capacity on 10 skills, and more than 90% capacity on 22 skills.
117
+
118
+ <p align="center" width="100%">
119
+ <a ><img src="imgs/evol-testset_skills-13b.png" alt="WizardLM" style="width: 100%; min-width: 300px; display: block; margin: auto;"></a>
120
+ </p>
121
+
122
+ ## Call for Feedbacks
123
+ We welcome everyone to use your professional and difficult instructions to evaluate WizardLM, 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 WizardLM. After that, we will open the code and pipeline of up-to-date Evol-Instruct algorithm and work with you together to improve it.
124
+
125
+ ## Unofficial Video Introductions
126
+ Thanks to the enthusiastic friends, their video introductions are more lively and interesting.
127
+ 1. [GET WizardLM NOW! 7B LLM KING That Can Beat ChatGPT! I'm IMPRESSED!](https://www.youtube.com/watch?v=SaJ8wyKMBds)
128
+ 2. [WizardLM: Enhancing Large Language Models to Follow Complex Instructions](https://www.youtube.com/watch?v=I6sER-qivYk)
129
+
130
+ ## Case Show
131
+ We just sample some cases to demonstrate the performance of WizardLM and ChatGPT on data of varying difficulty, and the details pls refer [Case Show](https://github.com/nlpxucan/WizardLM/blob/main/src/case_show.md).
132
+
133
+ ## Overview of Evol-Instruct
134
+
135
+ [Evol-Instruct](https://github.com/nlpxucan/evol-instruct) is a novel method using LLMs instead of humans to automatically mass-produce open-domain instructions of various difficulty levels and skills range, to improve the performance of LLMs.
136
+
137
+ <p align="center" width="100%">
138
+ <a ><img src="imgs/git_overall.png" alt="WizardLM" style="width: 86%; min-width: 300px; display: block; margin: auto;"></a>
139
+ </p>
140
+
141
+ <p align="center" width="100%">
142
+ <a ><img src="imgs/git_running.png" alt="WizardLM" style="width: 86%; min-width: 300px; display: block; margin: auto;"></a>
143
+ </p>
144
+
145
+ ## Contents
146
+
147
+ 1. [Online Demo](#online-demo)
148
+
149
+ 2. [Training Data](#training-data)
150
+
151
+ 3. [WizardLM Weights](#wizardlm-weights)
152
+
153
+ 4. [Fine-tuning](#fine-tuning)
154
+
155
+ 5. [Distributed Fine-tuning](#distributed-Fine-tuning)
156
+
157
+ 6. [Inference](#inference)
158
+
159
+ 7. [Evaluation](#evaluation)
160
+
161
+ 8. [Citation](#citation)
162
+
163
+ 9. [Disclaimer](#disclaimer)
164
+
165
+ ## Online Demo
166
+
167
+ 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** problems that you encounter in your work and life as possible. We will continue to evolve our models with your feedbacks.
168
+
169
+ [Demo Link](https://011fc8477ad734d7.gradio.app)
170
+
171
+ [Demo Backup 1](https://1825e531c43a23c7.gradio.app)
172
+
173
+
174
+
175
+
176
+ ## Training Data
177
+
178
+ [`alpaca_evol_instruct_70k.json`](https://huggingface.co/datasets/victor123/evol_instruct_70k) contains 70K instruction-following data generated from Evol-Instruct. We used it for fine-tuning the WizardLM model.
179
+ This JSON file is a list of dictionaries, each dictionary contains the following fields:
180
+
181
+ - `instruction`: `str`, describes the task the model should perform. Each of the 70K instructions is unique.
182
+ - `output`: `str`, the answer to the instruction as generated by `gpt-3.5-turbo`.
183
+
184
+
185
+
186
+ ## WizardLM Weights
187
+ We release [WizardLM] weights as delta weights to comply with the LLaMA model license.
188
+ You can add our delta to the original LLaMA weights to obtain the WizardLM weights. Instructions:
189
+ 1. Get the original LLaMA weights in the huggingface format by following the instructions [here](https://huggingface.co/docs/transformers/main/model_doc/llama).
190
+ 2. Please download our delta model at the following [link](https://huggingface.co/victor123/WizardLM)
191
+ 3. Use the following scripts to get WizardLM weights by applying our delta:
192
+ ```
193
+ python src/weight_diff_wizard.py recover --path_raw <path_to_step_1_dir> --path_diff <path_to_step_2_dir> --path_tuned <path_to_store_recovered_weights>
194
+ ```
195
+
196
+ ## Fine-tuning
197
+
198
+ We fine-tune WizardLM using code from [Llama-X](https://github.com/AetherCortex/Llama-X).
199
+ We fine-tune LLaMA-7B and LLaMA-13B with the following hyperparameters:
200
+
201
+ | Hyperparameter | LLaMA-7B | LLaMA-13B|
202
+ |----------------|----------|----------|
203
+ | Batch size | 64 | 384 |
204
+ | Learning rate | 2e-5 | 2e-5 |
205
+ | Epochs | 3 | 3 |
206
+ | Max length | 2048 | 2048 |
207
+ | Warmup step | 2 | 50 |
208
+ | LR scheduler | cosine | cosine |
209
+
210
+ To reproduce our fine-tuning of WizardLM, please follow the following steps:
211
+ 1. According to the instructions of [Llama-X](https://github.com/AetherCortex/Llama-X), install the environment, download the training code, and deploy.
212
+ 2. Replace the train.py with the train_freeform.py in our repo(src/train_freeform.py)
213
+ 3. Execute the following training command:
214
+ ```bash
215
+ deepspeed train_freeform.py \
216
+ --model_name_or_path /path/to/llama-7B/hf \
217
+ --data_path /path/to/alpaca_evol_instruct_70k.json \
218
+ --output_dir /path/to/wizardlm-7B/hf/ft \
219
+ --num_train_epochs 3 \
220
+ --model_max_length 2048 \
221
+ --per_device_train_batch_size 8 \
222
+ --per_device_eval_batch_size 1 \
223
+ --gradient_accumulation_steps 1 \
224
+ --evaluation_strategy "no" \
225
+ --save_strategy "steps" \
226
+ --save_steps 800 \
227
+ --save_total_limit 3 \
228
+ --learning_rate 2e-5 \
229
+ --warmup_steps 2 \
230
+ --logging_steps 2 \
231
+ --lr_scheduler_type "cosine" \
232
+ --report_to "tensorboard" \
233
+ --gradient_checkpointing True \
234
+ --deepspeed configs/deepspeed_config.json \
235
+ --fp16 True
236
+ ```
237
+
238
+ ## Distributed Fine-tuning
239
+ See [Distributed Fine-tuning](./doc/distributed_finetune.md)
240
+
241
+ ## Inference
242
+
243
+ We provide the decoding script for WizardLM, which reads a input file and generates corresponding responses for each sample, and finally consolidates them into an output file.
244
+
245
+ You can specify `base_model`, `input_data_path` and `output_data_path` in src\inference_wizardlm.py to set the decoding model, path of input file and path of output file.
246
+ The decoding command:
247
+ ```
248
+ python src\inference_wizardlm.py
249
+ ```
250
+
251
+ ### Evaluation
252
+
253
+ To evaluate Wizard, we conduct human evaluation on the inputs from our human instruct evaluation set [`WizardLM_testset.jsonl`](./data/WizardLM_testset.jsonl) . This evaluation set was collected by the authors and covers a diverse list of user-oriented instructions including difficult Coding Generation & Debugging, Math, Reasoning, Complex Formats, Academic Writing, Extensive Disciplines, and so on. We performed a blind pairwise comparison between Wizard and baselines. Specifically, we recruit 10 well-educated annotators to rank the models from 1 to 5 on relevance, knowledgeable, reasoning, calculation and accuracy.
254
+
255
+ WizardLM achieved significantly better results than Alpaca and Vicuna-7b.
256
+ <p align="center" width="60%">
257
+ <a ><img src="imgs/win.png" alt="WizardLM" style="width: 60%; min-width: 300px; display: block; margin: auto;"></a>
258
+ </p>
259
+
260
+ In the high-difficulty section of our test set (difficulty level >= 8), WizardLM even outperforms ChatGPT, with a win rate 7.9% larger than Chatgpt (42.9% vs. 35.0%). This indicates that our method can significantly improve the ability of large language models to handle complex instructions.
261
+ <p align="center" width="60%">
262
+ <a ><img src="imgs/windiff.png" alt="WizardLM" style="width: 60%; min-width: 300px; display: block; margin: auto;"></a>
263
+ </p>
264
+
265
+ ### Citation
266
+
267
+ Please cite the repo if you use the data or code in this repo.
268
+
269
+ ```
270
+ @misc{xu2023wizardlm,
271
+ title={WizardLM: Empowering Large Language Models to Follow Complex Instructions},
272
+ author={Can Xu and Qingfeng Sun and Kai Zheng and Xiubo Geng and Pu Zhao and Jiazhan Feng and Chongyang Tao and Daxin Jiang},
273
+ year={2023},
274
+ eprint={2304.12244},
275
+ archivePrefix={arXiv},
276
+ primaryClass={cs.CL}
277
+ }
278
+ ```
279
+ ## Disclaimer
280
+
281
+ 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 WizardLM 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.