Text Generation
Transformers
Safetensors
English
stablelm_epoch
causal-lm
conversational
custom_code
4-bit precision
gptq
TheBloke commited on
Commit
50f4c44
1 Parent(s): 0b9dccd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +514 -0
README.md ADDED
@@ -0,0 +1,514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: stabilityai/stablelm-zephyr-3b
3
+ datasets:
4
+ - HuggingFaceH4/ultrachat_200k
5
+ - HuggingFaceH4/ultrafeedback_binarized
6
+ - meta-math/MetaMathQA
7
+ - WizardLM/WizardLM_evol_instruct_V2_196k
8
+ - Intel/orca_dpo_pairs
9
+ inference: false
10
+ language:
11
+ - en
12
+ license: other
13
+ model_creator: Stability AI
14
+ model_name: StableLM Zephyr 3B
15
+ model_type: stablelm
16
+ prompt_template: '<|user|>
17
+
18
+ {prompt}<|endoftext|>
19
+
20
+ <|assistant|>
21
+
22
+ '
23
+ quantized_by: TheBloke
24
+ tags:
25
+ - causal-lm
26
+ ---
27
+ <!-- markdownlint-disable MD041 -->
28
+
29
+ <!-- header start -->
30
+ <!-- 200823 -->
31
+ <div style="width: auto; margin-left: auto; margin-right: auto">
32
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
33
+ </div>
34
+ <div style="display: flex; justify-content: space-between; width: 100%;">
35
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
36
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
37
+ </div>
38
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
39
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
40
+ </div>
41
+ </div>
42
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
43
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
44
+ <!-- header end -->
45
+
46
+ # StableLM Zephyr 3B - GPTQ
47
+ - Model creator: [Stability AI](https://huggingface.co/stabilityai)
48
+ - Original model: [StableLM Zephyr 3B](https://huggingface.co/stabilityai/stablelm-zephyr-3b)
49
+
50
+ <!-- description start -->
51
+ # Description
52
+
53
+ This repo contains GPTQ model files for [Stability AI's StableLM Zephyr 3B](https://huggingface.co/stabilityai/stablelm-zephyr-3b).
54
+
55
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
56
+
57
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
58
+
59
+ <!-- description end -->
60
+ <!-- repositories-available start -->
61
+ ## Repositories available
62
+
63
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ)
64
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GGUF)
65
+ * [Stability AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stabilityai/stablelm-zephyr-3b)
66
+ <!-- repositories-available end -->
67
+
68
+ <!-- prompt-template start -->
69
+ ## Prompt template: StableLM-Zephyr
70
+
71
+ ```
72
+ <|user|>
73
+ {prompt}<|endoftext|>
74
+ <|assistant|>
75
+
76
+ ```
77
+
78
+ <!-- prompt-template end -->
79
+
80
+
81
+
82
+ <!-- README_GPTQ.md-compatible clients start -->
83
+ ## Known compatible clients / servers
84
+
85
+ GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.
86
+
87
+ These GPTQ models are known to work in the following inference servers/webuis.
88
+
89
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
90
+ - [KoboldAI United](https://github.com/henk717/koboldai)
91
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
92
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
93
+
94
+ This may not be a complete list; if you know of others, please let me know!
95
+ <!-- README_GPTQ.md-compatible clients end -->
96
+
97
+ <!-- README_GPTQ.md-provided-files start -->
98
+ ## Provided files, and GPTQ parameters
99
+
100
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
101
+
102
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
103
+
104
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
105
+
106
+ <details>
107
+ <summary>Explanation of GPTQ parameters</summary>
108
+
109
+ - Bits: The bit size of the quantised model.
110
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
111
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
112
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
113
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
114
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
115
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
116
+
117
+ </details>
118
+
119
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
120
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
121
+ | [main](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 1.84 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
122
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 1.99 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
123
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 3.06 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
124
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 3.12 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
125
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 3.30 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
126
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 1.89 GB | No | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
127
+
128
+ <!-- README_GPTQ.md-provided-files end -->
129
+
130
+ <!-- README_GPTQ.md-download-from-branches start -->
131
+ ## How to download, including from branches
132
+
133
+ ### In text-generation-webui
134
+
135
+ To download from the `main` branch, enter `TheBloke/stablelm-zephyr-3b-GPTQ` in the "Download model" box.
136
+
137
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/stablelm-zephyr-3b-GPTQ:gptq-4bit-32g-actorder_True`
138
+
139
+ ### From the command line
140
+
141
+ I recommend using the `huggingface-hub` Python library:
142
+
143
+ ```shell
144
+ pip3 install huggingface-hub
145
+ ```
146
+
147
+ To download the `main` branch to a folder called `stablelm-zephyr-3b-GPTQ`:
148
+
149
+ ```shell
150
+ mkdir stablelm-zephyr-3b-GPTQ
151
+ huggingface-cli download TheBloke/stablelm-zephyr-3b-GPTQ --local-dir stablelm-zephyr-3b-GPTQ --local-dir-use-symlinks False
152
+ ```
153
+
154
+ To download from a different branch, add the `--revision` parameter:
155
+
156
+ ```shell
157
+ mkdir stablelm-zephyr-3b-GPTQ
158
+ huggingface-cli download TheBloke/stablelm-zephyr-3b-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir stablelm-zephyr-3b-GPTQ --local-dir-use-symlinks False
159
+ ```
160
+
161
+ <details>
162
+ <summary>More advanced huggingface-cli download usage</summary>
163
+
164
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
165
+
166
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
167
+
168
+ 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).
169
+
170
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
171
+
172
+ ```shell
173
+ pip3 install hf_transfer
174
+ ```
175
+
176
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
177
+
178
+ ```shell
179
+ mkdir stablelm-zephyr-3b-GPTQ
180
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/stablelm-zephyr-3b-GPTQ --local-dir stablelm-zephyr-3b-GPTQ --local-dir-use-symlinks False
181
+ ```
182
+
183
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
184
+ </details>
185
+
186
+ ### With `git` (**not** recommended)
187
+
188
+ To clone a specific branch with `git`, use a command like this:
189
+
190
+ ```shell
191
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/stablelm-zephyr-3b-GPTQ
192
+ ```
193
+
194
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
195
+
196
+ <!-- README_GPTQ.md-download-from-branches end -->
197
+ <!-- README_GPTQ.md-text-generation-webui start -->
198
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
199
+
200
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
201
+
202
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
203
+
204
+ 1. Click the **Model tab**.
205
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/stablelm-zephyr-3b-GPTQ`.
206
+
207
+ - To download from a specific branch, enter for example `TheBloke/stablelm-zephyr-3b-GPTQ:gptq-4bit-32g-actorder_True`
208
+ - see Provided Files above for the list of branches for each option.
209
+
210
+ 3. Click **Download**.
211
+ 4. The model will start downloading. Once it's finished it will say "Done".
212
+ 5. In the top left, click the refresh icon next to **Model**.
213
+ 6. In the **Model** dropdown, choose the model you just downloaded: `stablelm-zephyr-3b-GPTQ`
214
+ 7. The model will automatically load, and is now ready for use!
215
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
216
+
217
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
218
+
219
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
220
+
221
+ <!-- README_GPTQ.md-text-generation-webui end -->
222
+
223
+ <!-- README_GPTQ.md-use-from-tgi start -->
224
+ ## Serving this model from Text Generation Inference (TGI)
225
+
226
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
227
+
228
+ Example Docker parameters:
229
+
230
+ ```shell
231
+ --model-id TheBloke/stablelm-zephyr-3b-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
232
+ ```
233
+
234
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
235
+
236
+ ```shell
237
+ pip3 install huggingface-hub
238
+ ```
239
+
240
+ ```python
241
+ from huggingface_hub import InferenceClient
242
+
243
+ endpoint_url = "https://your-endpoint-url-here"
244
+
245
+ prompt = "Tell me about AI"
246
+ prompt_template=f'''<|user|>
247
+ {prompt}<|endoftext|>
248
+ <|assistant|>
249
+ '''
250
+
251
+ client = InferenceClient(endpoint_url)
252
+ response = client.text_generation(prompt,
253
+ max_new_tokens=128,
254
+ do_sample=True,
255
+ temperature=0.7,
256
+ top_p=0.95,
257
+ top_k=40,
258
+ repetition_penalty=1.1)
259
+
260
+ print(f"Model output: {response}")
261
+ ```
262
+ <!-- README_GPTQ.md-use-from-tgi end -->
263
+ <!-- README_GPTQ.md-use-from-python start -->
264
+ ## Python code example: inference from this GPTQ model
265
+
266
+ ### Install the necessary packages
267
+
268
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
269
+
270
+ ```shell
271
+ pip3 install --upgrade transformers optimum
272
+ # If using PyTorch 2.1 + CUDA 12.x:
273
+ pip3 install --upgrade auto-gptq
274
+ # or, if using PyTorch 2.1 + CUDA 11.x:
275
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
276
+ ```
277
+
278
+ If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:
279
+
280
+ ```shell
281
+ pip3 uninstall -y auto-gptq
282
+ git clone https://github.com/PanQiWei/AutoGPTQ
283
+ cd AutoGPTQ
284
+ git checkout v0.5.1
285
+ pip3 install .
286
+ ```
287
+
288
+ ### Example Python code
289
+
290
+ ```python
291
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
292
+
293
+ model_name_or_path = "TheBloke/stablelm-zephyr-3b-GPTQ"
294
+ # To use a different branch, change revision
295
+ # For example: revision="gptq-4bit-32g-actorder_True"
296
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
297
+ device_map="auto",
298
+ trust_remote_code=True,
299
+ revision="main")
300
+
301
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
302
+
303
+ prompt = "Tell me about AI"
304
+ prompt_template=f'''<|user|>
305
+ {prompt}<|endoftext|>
306
+ <|assistant|>
307
+ '''
308
+
309
+ print("\n\n*** Generate:")
310
+
311
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
312
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
313
+ print(tokenizer.decode(output[0]))
314
+
315
+ # Inference can also be done using transformers' pipeline
316
+
317
+ print("*** Pipeline:")
318
+ pipe = pipeline(
319
+ "text-generation",
320
+ model=model,
321
+ tokenizer=tokenizer,
322
+ max_new_tokens=512,
323
+ do_sample=True,
324
+ temperature=0.7,
325
+ top_p=0.95,
326
+ top_k=40,
327
+ repetition_penalty=1.1
328
+ )
329
+
330
+ print(pipe(prompt_template)[0]['generated_text'])
331
+ ```
332
+ <!-- README_GPTQ.md-use-from-python end -->
333
+
334
+ <!-- README_GPTQ.md-compatibility start -->
335
+ ## Compatibility
336
+
337
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
338
+
339
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
340
+
341
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
342
+ <!-- README_GPTQ.md-compatibility end -->
343
+
344
+ <!-- footer start -->
345
+ <!-- 200823 -->
346
+ ## Discord
347
+
348
+ For further support, and discussions on these models and AI in general, join us at:
349
+
350
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
351
+
352
+ ## Thanks, and how to contribute
353
+
354
+ Thanks to the [chirper.ai](https://chirper.ai) team!
355
+
356
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
357
+
358
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
359
+
360
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
361
+
362
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
363
+
364
+ * Patreon: https://patreon.com/TheBlokeAI
365
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
366
+
367
+ **Special thanks to**: Aemon Algiz.
368
+
369
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
370
+
371
+
372
+ Thank you to all my generous patrons and donaters!
373
+
374
+ And thank you again to a16z for their generous grant.
375
+
376
+ <!-- footer end -->
377
+
378
+ # Original model card: Stability AI's StableLM Zephyr 3B
379
+
380
+ # `StableLM Zephyr 3B`
381
+
382
+ ## Model Description
383
+
384
+ `StableLM Zephyr 3B` is a 3 billion parameter instruction tuned inspired by [HugginFaceH4's Zephyr 7B](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) training pipeline this model was trained on a mix of publicly available datasets, synthetic datasets using [Direct Preference Optimization (DPO)](https://arxiv.org/abs/2305.18290), evaluation for this model based on
385
+ [MT Bench](https://tatsu-lab.github.io/alpaca_eval/) and [Alpaca Benchmark](https://tatsu-lab.github.io/alpaca_eval/)
386
+
387
+ ## Usage
388
+
389
+ `StableLM Zephyr 3B` uses the following instruction format:
390
+ ```
391
+ <|user|>
392
+ List 3 synonyms for the word "tiny"<|endoftext|>
393
+ <|assistant|>
394
+ 1. Dwarf
395
+ 2. Little
396
+ 3. Petite<|endoftext|>
397
+ ```
398
+
399
+ This format is also available through the tokenizer's `apply_chat_template` method:
400
+
401
+ ```python
402
+ from transformers import AutoModelForCausalLM, AutoTokenizer
403
+
404
+ tokenizer = AutoTokenizer.from_pretrained('stabilityai/stablelm-zephyr-3b')
405
+ model = AutoModelForCausalLM.from_pretrained(
406
+ 'stabilityai/stablelm-zephyr-3b',
407
+ trust_remote_code=True,
408
+ device_map="auto"
409
+ )
410
+
411
+ prompt = [{'role': 'user', 'content': 'List 3 synonyms for the word "tiny"'}]
412
+ inputs = tokenizer.apply_chat_template(
413
+ prompt,
414
+ add_generation_prompt=True,
415
+ return_tensors='pt'
416
+ )
417
+
418
+ tokens = model.generate(
419
+ inputs.to(model.device),
420
+ max_new_tokens=1024,
421
+ temperature=0.8,
422
+ do_sample=True
423
+ )
424
+
425
+ print(tokenizer.decode(tokens[0], skip_special_tokens=False))
426
+ ```
427
+
428
+ You can also see how to run a performance optimized version of this model [here](https://github.com/eaidova/openvino_notebooks/blob/ea/stateful_chatbot/notebooks/273-stable-zephyr-3b-chatbot/273-stable-zephyr-3b-chatbot.ipynb) using [OpenVINO](https://docs.openvino.ai/2023.2/home.html) from Intel.
429
+
430
+ ## Model Details
431
+
432
+ * **Developed by**: [Stability AI](https://stability.ai/)
433
+ * **Model type**: `StableLM Zephyr 3B` model is an auto-regressive language model based on the transformer decoder architecture.
434
+ * **Language(s)**: English
435
+ * **Library**: [Alignment Handbook](https://github.com/huggingface/alignment-handbook.git)
436
+ * **Finetuned from model**: [stabilityai/stablelm-3b-4e1t](https://huggingface.co/stabilityai/stablelm-3b-4e1t)
437
+ * **License**: [StabilityAI Non-Commercial Research Community License](https://huggingface.co/stabilityai/stablelm-zephyr-3b/raw/main/LICENSE)
438
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
439
+
440
+ ### Training Dataset
441
+
442
+ The dataset is comprised of a mixture of open datasets large-scale datasets available on the [HuggingFace Hub](https://huggingface.co/datasets):
443
+ 1. SFT Datasets
444
+ - HuggingFaceH4/ultrachat_200k
445
+ - meta-math/MetaMathQA
446
+ - WizardLM/WizardLM_evol_instruct_V2_196k
447
+ - Open-Orca/SlimOrca
448
+ 2. Preference Datasets:
449
+ - HuggingFaceH4/ultrafeedback_binarized
450
+ - Intel/orca_dpo_pairs
451
+
452
+ ## Performance
453
+
454
+ ### MT-Bench and Alpaca Bench
455
+
456
+
457
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/6310474ca119d49bc1eb0d80/8WIZS6dAlu5kSH-382pMl.png" alt="mt_bench_plot" width="600"/>
458
+
459
+ | Model | Size | Alignment | MT-Bench (score) | AlpacaEval (win rate %) |
460
+ |-------------|-----|----|---------------|--------------|
461
+ | **StableLM Zephyr 3B** 🪁 | 3B | DPO | 6.64 | 76.00 |
462
+ | StableLM Zephyr (SFT only) | 3B | SFT | 6.04 | 71.15 |
463
+ | Capybara v1.9 | 3B | dSFT | 5.94 | - |
464
+ | MPT-Chat | 7B |dSFT |5.42| -|
465
+ | Xwin-LM v0.1 | 7B| dPPO| 6.19| 87.83|
466
+ | Mistral-Instruct v0.1 | 7B| - | 6.84 |-|
467
+ | Zephyr-7b-α |7B| dDPO| 6.88| -|
468
+ | Zephyr-7b-β| 7B | dDPO | 7.34 | 90.60 |
469
+ | Falcon-Instruct | 40B |dSFT |5.17 |45.71|
470
+ | Guanaco | 65B | SFT |6.41| 71.80|
471
+ | Llama2-Chat | 70B |RLHF |6.86| 92.66|
472
+ | Vicuna v1.3 | 33B |dSFT |7.12 |88.99|
473
+ | WizardLM v1.0 | 70B |dSFT |7.71 |-|
474
+ | Xwin-LM v0.1 | 70B |dPPO |- |95.57|
475
+ | GPT-3.5-turbo | - |RLHF |7.94 |89.37|
476
+ | Claude 2 | - |RLHF |8.06| 91.36|
477
+ | GPT-4 | -| RLHF |8.99| 95.28|
478
+
479
+ ## Other benchmarks:
480
+ | Task | Value |
481
+ |-----------------------|---------------------------|
482
+ | ARC (25-shot) | 47.0 |
483
+ | HellaSwag (10-shot) | 74.2 |
484
+ | MMLU (5-shot) | 46.3 |
485
+ | TruthfulQA (0-shot) | 46.5 |
486
+ | Winogrande (5-shot) | 65.5 |
487
+ | GSM8K (5-shot) | 42.3 |
488
+ | BigBench (Avg) | 35.26 |
489
+ | AGI Benchmark (Avg) | 33.23 |
490
+
491
+ ### Training Infrastructure
492
+
493
+ * **Hardware**: `StableLM Zephyr 3B` was trained on the Stability AI cluster across 8 nodes with 8 A100 80GBs GPUs for each nodes.
494
+ * **Code Base**: We use our internal script for SFT steps and used [HuggingFace Alignment Handbook script](https://github.com/huggingface/alignment-handbook) for DPO training.
495
+
496
+ ## Commitment to Ethical AI
497
+ In line with our responsibility towards ethical AI development, `StableLM Zephyr 3B` is released with a focus on ensuring safety, reliability, and appropriateness in its applications. To this end, we have evaluated `StableLM Zephyr 3B` on 488 malicious prompts and used standard protocols to assess the harmfulness of its outputs. Compared to Zephyr-7b-β, `StableLM Zephyr 3B` reduces the number of harmful outputs as assessed by GPT-4 by 55. Additionally, we performed an internal red teaming event targeting the following abuse areas:
498
+ * **Self-Harm Methods**: (Suicide Methods, Encouragement of Self-Harm, Methods and encouragement of Eating Disorders)
499
+ * **Misinformation**: (Health, Conspiracy Theories, Social Unrest/Conflict, Political Misinformation, & Climate change)
500
+ * **Hate Speech**: (Race, Stereotypes, Immigrants, Gender, Personally Identifiable Information such as Social security numbers, Full names, ID numbers, Email addresses, and telephone numbers)
501
+
502
+ We have incorporated the findings of our malicious prompts evaluation and red teaming event into our release. Users are encouraged to fine-tune and evaluate the model to suit their specific needs, considering the potential biases and limitations found in `StableLM Zephyr 3B` and inherent in other LLM models.
503
+
504
+ ## Use and Limitations
505
+
506
+ ### Intended Use
507
+
508
+ The model is intended to be used as a foundational base model for application-specific fine-tuning. Developers must evaluate and fine-tune the model for safe performance in downstream applications.
509
+
510
+ ### Limitations and Bias
511
+
512
+ This model is not trained against adversarial inputs. We strongly recommend pairing this model with an input and output classifier to prevent harmful responses.
513
+
514
+ Through our internal red teaming, we discovered that while the model will not output harmful information if not prompted to do so, it is willing to output potentially harmful outputs or misinformation when the user requests it. Using this model will require guardrails around your inputs and outputs to ensure that any outputs returned are not misinformation or harmful. Additionally, as each use case is unique, we recommend running your own suite of tests to ensure proper performance of this model. Finally, do not use the models if they are unsuitable for your application, or for any applications that may cause deliberate or unintentional harm to others.