KLMFOREVER commited on
Commit
4cc4e60
1 Parent(s): b03555f

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +345 -0
README.md ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - quantized
4
+ - 4-bit
5
+ - GGUF
6
+ - transformers
7
+ - safetensors
8
+ - mistral
9
+ - text-generation
10
+ - arxiv:2304.12244
11
+ - arxiv:2306.08568
12
+ - arxiv:2308.09583
13
+ - license:apache-2.0
14
+ - autotrain_compatible
15
+ - endpoints_compatible
16
+ - text-generation-inference
17
+ - region:fr
18
+ - text-generation
19
+ model_name: WizardLM-2-7B-GGUF
20
+ base_model: microsoft/WizardLM-2-7B
21
+ inference: false
22
+ model_creator: microsoft
23
+ pipeline_tag: text-generation
24
+ quantized_by: MaziyarPanahi
25
+ ---
26
+ # [MaziyarPanahi/WizardLM-2-7B-GGUF](https://huggingface.co/MaziyarPanahi/WizardLM-2-7B-GGUF)
27
+ - Model creator: [microsoft](https://huggingface.co/microsoft)
28
+ - Original model: [microsoft/WizardLM-2-7B](https://huggingface.co/microsoft/WizardLM-2-7B)
29
+
30
+ ## Description
31
+ [MaziyarPanahi/WizardLM-2-7B-GGUF](https://huggingface.co/MaziyarPanahi/WizardLM-2-7B-GGUF) contains GGUF format model files for [microsoft/WizardLM-2-7B](https://huggingface.co/microsoft/WizardLM-2-7B).
32
+
33
+
34
+ ## Prompt template
35
+
36
+ ```
37
+ {system_prompt}
38
+ USER: {prompt}
39
+ ASSISTANT: </s>
40
+ ```
41
+
42
+ or
43
+
44
+ ```
45
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful,
46
+ detailed, and polite answers to the user's questions. USER: Hi ASSISTANT: Hello.</s>
47
+ USER: {prompt} ASSISTANT: </s>......
48
+ ```
49
+
50
+ Taken from the original README
51
+ ---
52
+ ---
53
+ license: apache-2.0
54
+ ---
55
+
56
+
57
+
58
+
59
+ <p style="font-size:20px;" align="center">
60
+ 🏠 <a href="https://wizardlm.github.io/WizardLM2" target="_blank">WizardLM-2 Release Blog</a> </p>
61
+ <p align="center">
62
+ 🤗 <a href="https://huggingface.co/collections/microsoft/wizardlm-2-661d403f71e6c8257dbd598a" target="_blank">HF Repo</a> •🐱 <a href="https://github.com/victorsungo/WizardLM/tree/main/WizardLM-2" target="_blank">Github 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> • 📃 <a href="https://arxiv.org/abs/2308.09583" target="_blank">[WizardMath]</a> <br>
63
+ </p>
64
+ <p align="center">
65
+ 👋 Join our <a href="https://discord.gg/VZjjHtWrKs" target="_blank">Discord</a>
66
+ </p>
67
+
68
+
69
+
70
+ ## News 🔥🔥🔥 [2024/04/15]
71
+
72
+ We introduce and opensource WizardLM-2, our next generation state-of-the-art large language models,
73
+ which have improved performance on complex chat, multilingual, reasoning and agent.
74
+ New family includes three cutting-edge models: WizardLM-2 8x22B, WizardLM-2 70B, and WizardLM-2 7B.
75
+
76
+ - WizardLM-2 8x22B is our most advanced model, demonstrates highly competitive performance compared to those leading proprietary works
77
+ and consistently outperforms all the existing state-of-the-art opensource models.
78
+ - WizardLM-2 70B reaches top-tier reasoning capabilities and is the first choice in the same size.
79
+ - WizardLM-2 7B is the fastest and achieves comparable performance with existing 10x larger opensource leading models.
80
+
81
+ For more details of WizardLM-2 please read our [release blog post](https://wizardlm.github.io/WizardLM2) and upcoming paper.
82
+
83
+
84
+ ## Model Details
85
+
86
+ * **Model name**: WizardLM-2 7B
87
+ * **Developed by**: WizardLM@Microsoft AI
88
+ * **Base model**: [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
89
+ * **Parameters**: 7B
90
+ * **Language(s)**: Multilingual
91
+ * **Blog**: [Introducing WizardLM-2](https://wizardlm.github.io/WizardLM2)
92
+ * **Repository**: [https://github.com/nlpxucan/WizardLM](https://github.com/nlpxucan/WizardLM)
93
+ * **Paper**: WizardLM-2 (Upcoming)
94
+ * **License**: Apache2.0
95
+
96
+
97
+
98
+ ## Model Capacities
99
+
100
+
101
+ **MT-Bench**
102
+
103
+ We also adopt the automatic MT-Bench evaluation framework based on GPT-4 proposed by lmsys to assess the performance of models.
104
+ The WizardLM-2 8x22B even demonstrates highly competitive performance compared to the most advanced proprietary models.
105
+ Meanwhile, WizardLM-2 7B and WizardLM-2 70B are all the top-performing models among the other leading baselines at 7B to 70B model scales.
106
+
107
+ <p align="center" width="100%">
108
+ <a ><img src="https://raw.githubusercontent.com/WizardLM/WizardLM2/main/static/images/mtbench.png" alt="MTBench" style="width: 96%; min-width: 300px; display: block; margin: auto;"></a>
109
+ </p>
110
+
111
+
112
+ **Human Preferences Evaluation**
113
+
114
+ We carefully collected a complex and challenging set consisting of real-world instructions, which includes main requirements of humanity, such as writing, coding, math, reasoning, agent, and multilingual.
115
+ We report the win:loss rate without tie:
116
+
117
+ - WizardLM-2 8x22B is just slightly falling behind GPT-4-1106-preview, and significantly stronger than Command R Plus and GPT4-0314.
118
+ - WizardLM-2 70B is better than GPT4-0613, Mistral-Large, and Qwen1.5-72B-Chat.
119
+ - WizardLM-2 7B is comparable with Qwen1.5-32B-Chat, and surpasses Qwen1.5-14B-Chat and Starling-LM-7B-beta.
120
+
121
+ <p align="center" width="100%">
122
+ <a ><img src="https://raw.githubusercontent.com/WizardLM/WizardLM2/main/static/images/winall.png" alt="Win" style="width: 96%; min-width: 300px; display: block; margin: auto;"></a>
123
+ </p>
124
+
125
+
126
+
127
+
128
+
129
+ ## Method Overview
130
+ We built a **fully AI powered synthetic training system** to train WizardLM-2 models, please refer to our [blog](https://wizardlm.github.io/WizardLM2) for more details of this system.
131
+
132
+ <p align="center" width="100%">
133
+ <a ><img src="https://raw.githubusercontent.com/WizardLM/WizardLM2/main/static/images/exp_1.png" alt="Method" style="width: 96%; min-width: 300px; display: block; margin: auto;"></a>
134
+ </p>
135
+
136
+
137
+
138
+ ## Usage
139
+
140
+ ❗<b>Note for model system prompts usage:</b>
141
+
142
+
143
+ <b>WizardLM-2</b> adopts the prompt format from <b>Vicuna</b> and supports **multi-turn** conversation. The prompt should be as following:
144
+
145
+ ```
146
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful,
147
+ detailed, and polite answers to the user's questions. USER: Hi ASSISTANT: Hello.</s>
148
+ USER: Who are you? ASSISTANT: I am WizardLM.</s>......
149
+ ```
150
+
151
+ <b> Inference WizardLM-2 Demo Script</b>
152
+
153
+ We provide a WizardLM-2 inference demo [code](https://github.com/nlpxucan/WizardLM/tree/main/demo) on our github.
154
+
155
+ ---
156
+
157
+ ## How to use
158
+ Thanks to [TheBloke](https://huggingface.co/TheBloke) for preparing an amazing README on how to use GGUF models:
159
+
160
+ ### About GGUF
161
+
162
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
163
+
164
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
165
+
166
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
167
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
168
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
169
+ * [GPT4All](https://gpt4all.io/index.html), a free and open source local running GUI, supporting Windows, Linux and macOS with full GPU accel.
170
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration. Linux available, in beta as of 27/11/2023.
171
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
172
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
173
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
174
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
175
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server. Note, as of time of writing (November 27th 2023), ctransformers has not been updated in a long time and does not support many recent models.
176
+
177
+ ### Explanation of quantisation methods
178
+
179
+ <details>
180
+ <summary>Click to see details</summary>
181
+
182
+ The new methods available are:
183
+
184
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
185
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
186
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
187
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
188
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
189
+
190
+ ## How to download GGUF files
191
+
192
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
193
+
194
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
195
+
196
+ * LM Studio
197
+ * LoLLMS Web UI
198
+ * Faraday.dev
199
+
200
+ ### In `text-generation-webui`
201
+
202
+ Under Download Model, you can enter the model repo: [MaziyarPanahi/WizardLM-2-7B-GGUF](https://huggingface.co/MaziyarPanahi/WizardLM-2-7B-GGUF) and below it, a specific filename to download, such as: WizardLM-2-7B-GGUF.Q4_K_M.gguf.
203
+
204
+ Then click Download.
205
+
206
+ ### On the command line, including multiple files at once
207
+
208
+ I recommend using the `huggingface-hub` Python library:
209
+
210
+ ```shell
211
+ pip3 install huggingface-hub
212
+ ```
213
+
214
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
215
+
216
+ ```shell
217
+ huggingface-cli download MaziyarPanahi/WizardLM-2-7B-GGUF WizardLM-2-7B.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
218
+ ```
219
+ </details>
220
+ <details>
221
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
222
+
223
+ You can also download multiple files at once with a pattern:
224
+
225
+ ```shell
226
+ huggingface-cli download [MaziyarPanahi/WizardLM-2-7B-GGUF](https://huggingface.co/MaziyarPanahi/WizardLM-2-7B-GGUF) --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
227
+ ```
228
+
229
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
230
+
231
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
232
+
233
+ ```shell
234
+ pip3 install hf_transfer
235
+ ```
236
+
237
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
238
+
239
+ ```shell
240
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download MaziyarPanahi/WizardLM-2-7B-GGUF WizardLM-2-7B.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
241
+ ```
242
+
243
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
244
+ </details>
245
+
246
+ ## Example `llama.cpp` command
247
+
248
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
249
+
250
+ ```shell
251
+ ./main -ngl 35 -m WizardLM-2-7B.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|im_start|>system
252
+ {system_message}<|im_end|>
253
+ <|im_start|>user
254
+ {prompt}<|im_end|>
255
+ <|im_start|>assistant"
256
+ ```
257
+
258
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
259
+
260
+ Change `-c 32768` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
261
+
262
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
263
+
264
+ For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
265
+
266
+ ## How to run in `text-generation-webui`
267
+
268
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20-%20Model%20Tab.md#llamacpp).
269
+
270
+ ## How to run from Python code
271
+
272
+ You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
273
+
274
+ ### How to load this model in Python code, using llama-cpp-python
275
+
276
+ For full documentation, please see: [llama-cpp-python docs](https://github.com/abetlen/llama-cpp-python/).
277
+
278
+ #### First install the package
279
+
280
+ Run one of the following commands, according to your system:
281
+
282
+ ```shell
283
+ # Base ctransformers with no GPU acceleration
284
+ pip install llama-cpp-python
285
+ # With NVidia CUDA acceleration
286
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
287
+ # Or with OpenBLAS acceleration
288
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
289
+ # Or with CLBLast acceleration
290
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
291
+ # Or with AMD ROCm GPU acceleration (Linux only)
292
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
293
+ # Or with Metal GPU acceleration for macOS systems only
294
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
295
+
296
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
297
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
298
+ pip install llama-cpp-python
299
+ ```
300
+
301
+ #### Simple llama-cpp-python example code
302
+
303
+ ```python
304
+ from llama_cpp import Llama
305
+
306
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
307
+ llm = Llama(
308
+ model_path="./WizardLM-2-7B.Q4_K_M.gguf", # Download the model file first
309
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
310
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
311
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
312
+ )
313
+
314
+ # Simple inference example
315
+ output = llm(
316
+ "<|im_start|>system
317
+ {system_message}<|im_end|>
318
+ <|im_start|>user
319
+ {prompt}<|im_end|>
320
+ <|im_start|>assistant", # Prompt
321
+ max_tokens=512, # Generate up to 512 tokens
322
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
323
+ echo=True # Whether to echo the prompt
324
+ )
325
+
326
+ # Chat Completion API
327
+
328
+ llm = Llama(model_path="./WizardLM-2-7B.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
329
+ llm.create_chat_completion(
330
+ messages = [
331
+ {"role": "system", "content": "You are a story writing assistant."},
332
+ {
333
+ "role": "user",
334
+ "content": "Write a story about llamas."
335
+ }
336
+ ]
337
+ )
338
+ ```
339
+
340
+ ## How to use with LangChain
341
+
342
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
343
+
344
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
345
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)