Llamarider222 commited on
Commit
8f2330c
1 Parent(s): 17f534e

Upload 8 files

Browse files
README.md ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mixtral-8x7B-Instruct-v0.1
3
+ inference: false
4
+ language:
5
+ - fr
6
+ - it
7
+ - de
8
+ - es
9
+ - en
10
+ license: apache-2.0
11
+ model_creator: Mistral AI_
12
+ model_name: Mixtral 8X7B Instruct v0.1
13
+ model_type: mixtral
14
+ prompt_template: '[INST] {prompt} [/INST]
15
+
16
+ '
17
+ quantized_by: TheBloke
18
+ widget:
19
+ - output:
20
+ text: 'Arr, shiver me timbers! Ye have a llama on yer lawn, ye say? Well, that
21
+ be a new one for me! Here''s what I''d suggest, arr:
22
+
23
+
24
+ 1. Firstly, ensure yer safety. Llamas may look gentle, but they can be protective
25
+ if they feel threatened.
26
+
27
+ 2. Try to make the area less appealing to the llama. Remove any food sources
28
+ or water that might be attracting it.
29
+
30
+ 3. Contact local animal control or a wildlife rescue organization. They be the
31
+ experts and can provide humane ways to remove the llama from yer property.
32
+
33
+ 4. If ye have any experience with animals, you could try to gently herd the
34
+ llama towards a nearby field or open space. But be careful, arr!
35
+
36
+
37
+ Remember, arr, it be important to treat the llama with respect and care. It
38
+ be a creature just trying to survive, like the rest of us.'
39
+ text: '[INST] You are a pirate chatbot who always responds with Arr and pirate speak!
40
+
41
+ There''s a llama on my lawn, how can I get rid of him? [/INST]'
42
+ ---
43
+ <!-- markdownlint-disable MD041 -->
44
+
45
+ <!-- header start -->
46
+ <!-- 200823 -->
47
+ <div style="width: auto; margin-left: auto; margin-right: auto">
48
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
49
+ </div>
50
+ <div style="display: flex; justify-content: space-between; width: 100%;">
51
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
52
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
53
+ </div>
54
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
55
+ <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>
56
+ </div>
57
+ </div>
58
+ <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>
59
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
60
+ <!-- header end -->
61
+
62
+ # Mixtral 8X7B Instruct v0.1 - GPTQ
63
+ - Model creator: [Mistral AI_](https://huggingface.co/mistralai)
64
+ - Original model: [Mixtral 8X7B Instruct v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1)
65
+
66
+ <!-- description start -->
67
+ # Description
68
+
69
+ This repo contains GPTQ model files for [Mistral AI_'s Mixtral 8X7B Instruct v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1).
70
+
71
+ Mixtral GPTQs currently require:
72
+ * Transformers 4.36.0 or later
73
+ * either, AutoGPTQ 0.6 compiled from source, or
74
+ * Transformers 4.37.0.dev0 compiled from Github with: `pip3 install git+https://github.com/huggingface/transformers`
75
+
76
+ 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.
77
+
78
+ <!-- description end -->
79
+ <!-- repositories-available start -->
80
+ ## Repositories available
81
+
82
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-AWQ)
83
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ)
84
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GGUF)
85
+ * [Mistral AI_'s original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1)
86
+ <!-- repositories-available end -->
87
+
88
+ <!-- prompt-template start -->
89
+ ## Prompt template: Mistral
90
+
91
+ ```
92
+ [INST] {prompt} [/INST]
93
+
94
+ ```
95
+
96
+ <!-- prompt-template end -->
97
+
98
+
99
+
100
+ <!-- README_GPTQ.md-compatible clients start -->
101
+ ## Known compatible clients / servers
102
+
103
+ GPTQ models are currently supported on Linux (NVidia/AMD) and Windows (NVidia only). macOS users: please use GGUF models.
104
+
105
+ Mixtral GPTQs currently have special requirements - see Description above.
106
+
107
+ <!-- README_GPTQ.md-compatible clients end -->
108
+
109
+ <!-- README_GPTQ.md-provided-files start -->
110
+ ## Provided files, and GPTQ parameters
111
+
112
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
113
+
114
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
115
+
116
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
117
+
118
+ <details>
119
+ <summary>Explanation of GPTQ parameters</summary>
120
+
121
+ - Bits: The bit size of the quantised model.
122
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
123
+ - 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.
124
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
125
+ - 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).
126
+ - 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.
127
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
128
+
129
+ </details>
130
+
131
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
132
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
133
+ | [main](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/main) | 4 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 23.81 GB | No | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
134
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 24.70 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
135
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 27.42 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
136
+ | [gptq-3bit--1g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-3bit--1g-actorder_True) | 3 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.01 GB | No | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
137
+ | [gptq-3bit-128g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-3bit-128g-actorder_True) | 3 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 18.85 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
138
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 47.04 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
139
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 8192 | 48.10 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
140
+
141
+ <!-- README_GPTQ.md-provided-files end -->
142
+
143
+ <!-- README_GPTQ.md-download-from-branches start -->
144
+ ## How to download, including from branches
145
+
146
+ ### In text-generation-webui
147
+
148
+ To download from the `main` branch, enter `TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ` in the "Download model" box.
149
+
150
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ:gptq-4bit-128g-actorder_True`
151
+
152
+ ### From the command line
153
+
154
+ I recommend using the `huggingface-hub` Python library:
155
+
156
+ ```shell
157
+ pip3 install huggingface-hub
158
+ ```
159
+
160
+ To download the `main` branch to a folder called `Mixtral-8x7B-Instruct-v0.1-GPTQ`:
161
+
162
+ ```shell
163
+ mkdir Mixtral-8x7B-Instruct-v0.1-GPTQ
164
+ huggingface-cli download TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ --local-dir Mixtral-8x7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
165
+ ```
166
+
167
+ To download from a different branch, add the `--revision` parameter:
168
+
169
+ ```shell
170
+ mkdir Mixtral-8x7B-Instruct-v0.1-GPTQ
171
+ huggingface-cli download TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir Mixtral-8x7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
172
+ ```
173
+
174
+ <details>
175
+ <summary>More advanced huggingface-cli download usage</summary>
176
+
177
+ 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.
178
+
179
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
180
+
181
+ 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).
182
+
183
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
184
+
185
+ ```shell
186
+ pip3 install hf_transfer
187
+ ```
188
+
189
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
190
+
191
+ ```shell
192
+ mkdir Mixtral-8x7B-Instruct-v0.1-GPTQ
193
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ --local-dir Mixtral-8x7B-Instruct-v0.1-GPTQ --local-dir-use-symlinks False
194
+ ```
195
+
196
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
197
+ </details>
198
+
199
+ ### With `git` (**not** recommended)
200
+
201
+ To clone a specific branch with `git`, use a command like this:
202
+
203
+ ```shell
204
+ git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ
205
+ ```
206
+
207
+ 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.)
208
+
209
+ <!-- README_GPTQ.md-download-from-branches end -->
210
+ <!-- README_GPTQ.md-text-generation-webui start -->
211
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
212
+
213
+ **NOTE**: Requires:
214
+
215
+ * Transformers 4.36.0, or Transformers 4.37.0.dev0 from Github
216
+ * Either AutoGPTQ 0.6 compiled from source and `Loader: AutoGPTQ`,
217
+ * or, `Loader: Transformers`, if you installed Transformers from Github: `pip3 install git+https://github.com/huggingface/transformers`
218
+
219
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
220
+
221
+ 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.
222
+
223
+ 1. Click the **Model tab**.
224
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ`.
225
+
226
+ - To download from a specific branch, enter for example `TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ:gptq-4bit-128g-actorder_True`
227
+ - see Provided Files above for the list of branches for each option.
228
+
229
+ 3. Click **Download**.
230
+ 4. The model will start downloading. Once it's finished it will say "Done".
231
+ 5. In the top left, click the refresh icon next to **Model**.
232
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mixtral-8x7B-Instruct-v0.1-GPTQ`
233
+ 7. The model will automatically load, and is now ready for use!
234
+ 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.
235
+
236
+ - 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`.
237
+
238
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
239
+
240
+ <!-- README_GPTQ.md-text-generation-webui end -->
241
+
242
+ <!-- README_GPTQ.md-use-from-tgi start -->
243
+ ## Serving this model from Text Generation Inference (TGI)
244
+
245
+ Not currently supported for Mixtral models.
246
+
247
+ <!-- README_GPTQ.md-use-from-tgi end -->
248
+ <!-- README_GPTQ.md-use-from-python start -->
249
+ ## Python code example: inference from this GPTQ model
250
+
251
+ ### Install the necessary packages
252
+
253
+ Requires: Transformers 4.37.0.dev0 from Github, Optimum 1.16.0 or later, and AutoGPTQ 0.5.1 or later.
254
+
255
+ ```shell
256
+ pip3 install --upgrade "git+https://github.com/huggingface/transformers" optimum
257
+ # If using PyTorch 2.1 + CUDA 12.x:
258
+ pip3 install --upgrade auto-gptq
259
+ # or, if using PyTorch 2.1 + CUDA 11.x:
260
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
261
+ ```
262
+
263
+ 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:
264
+
265
+ ```shell
266
+ pip3 uninstall -y auto-gptq
267
+ git clone https://github.com/PanQiWei/AutoGPTQ
268
+ cd AutoGPTQ
269
+ DISABLE_QIGEN=1 pip3 install .
270
+ ```
271
+
272
+ ### Example Python code
273
+
274
+ ```python
275
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
276
+
277
+ model_name_or_path = "TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ"
278
+ # To use a different branch, change revision
279
+ # For example: revision="gptq-4bit-128g-actorder_True"
280
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
281
+ device_map="auto",
282
+ trust_remote_code=False,
283
+ revision="main")
284
+
285
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
286
+
287
+ prompt = "Write a story about llamas"
288
+ system_message = "You are a story writing assistant"
289
+ prompt_template=f'''[INST] {prompt} [/INST]
290
+ '''
291
+
292
+ print("\n\n*** Generate:")
293
+
294
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
295
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
296
+ print(tokenizer.decode(output[0]))
297
+
298
+ # Inference can also be done using transformers' pipeline
299
+
300
+ print("*** Pipeline:")
301
+ pipe = pipeline(
302
+ "text-generation",
303
+ model=model,
304
+ tokenizer=tokenizer,
305
+ max_new_tokens=512,
306
+ do_sample=True,
307
+ temperature=0.7,
308
+ top_p=0.95,
309
+ top_k=40,
310
+ repetition_penalty=1.1
311
+ )
312
+
313
+ print(pipe(prompt_template)[0]['generated_text'])
314
+ ```
315
+ <!-- README_GPTQ.md-use-from-python end -->
316
+
317
+ <!-- README_GPTQ.md-compatibility start -->
318
+ ## Compatibility
319
+
320
+ The files provided are tested to work with AutoGPTQ 0.6 (compiled from source) and Transformers 4.37.0 (installed from Github).
321
+
322
+ <!-- README_GPTQ.md-compatibility end -->
323
+
324
+ <!-- footer start -->
325
+ <!-- 200823 -->
326
+ ## Discord
327
+
328
+ For further support, and discussions on these models and AI in general, join us at:
329
+
330
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
331
+
332
+ ## Thanks, and how to contribute
333
+
334
+ Thanks to the [chirper.ai](https://chirper.ai) team!
335
+
336
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
337
+
338
+ 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.
339
+
340
+ 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.
341
+
342
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
343
+
344
+ * Patreon: https://patreon.com/TheBlokeAI
345
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
346
+
347
+ **Special thanks to**: Aemon Algiz.
348
+
349
+ **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
350
+
351
+
352
+ Thank you to all my generous patrons and donaters!
353
+
354
+ And thank you again to a16z for their generous grant.
355
+
356
+ <!-- footer end -->
357
+
358
+ # Original model card: Mistral AI_'s Mixtral 8X7B Instruct v0.1
359
+
360
+ # Model Card for Mixtral-8x7B
361
+ The Mixtral-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The Mixtral-8x7B outperforms Llama 2 70B on most benchmarks we tested.
362
+
363
+ For full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-of-experts/).
364
+
365
+ ## Warning
366
+ This repo contains weights that are compatible with [vLLM](https://github.com/vllm-project/vllm) serving of the model as well as Hugging Face [transformers](https://github.com/huggingface/transformers) library. It is based on the original Mixtral [torrent release](magnet:?xt=urn:btih:5546272da9065eddeb6fcd7ffddeef5b75be79a7&dn=mixtral-8x7b-32kseqlen&tr=udp%3A%2F%http://2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=http%3A%2F%http://2Ftracker.openbittorrent.com%3A80%2Fannounce), but the file format and parameter names are different. Please note that model cannot (yet) be instantiated with HF.
367
+
368
+ ## Instruction format
369
+
370
+ This format must be strictly respected, otherwise the model will generate sub-optimal outputs.
371
+
372
+ The template used to build a prompt for the Instruct model is defined as follows:
373
+ ```
374
+ <s> [INST] Instruction [/INST] Model answer</s> [INST] Follow-up instruction [/INST]
375
+ ```
376
+ Note that `<s>` and `</s>` are special tokens for beginning of string (BOS) and end of string (EOS) while [INST] and [/INST] are regular strings.
377
+
378
+ As reference, here is the pseudo-code used to tokenize instructions during fine-tuning:
379
+ ```python
380
+ def tokenize(text):
381
+ return tok.encode(text, add_special_tokens=False)
382
+
383
+ [BOS_ID] +
384
+ tokenize("[INST]") + tokenize(USER_MESSAGE_1) + tokenize("[/INST]") +
385
+ tokenize(BOT_MESSAGE_1) + [EOS_ID] +
386
+
387
+ tokenize("[INST]") + tokenize(USER_MESSAGE_N) + tokenize("[/INST]") +
388
+ tokenize(BOT_MESSAGE_N) + [EOS_ID]
389
+ ```
390
+
391
+ In the pseudo-code above, note that the `tokenize` method should not add a BOS or EOS token automatically, but should add a prefix space.
392
+
393
+ ## Run the model
394
+
395
+ ```python
396
+ from transformers import AutoModelForCausalLM, AutoTokenizer
397
+
398
+ model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
399
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
400
+
401
+ model = AutoModelForCausalLM.from_pretrained(model_id)
402
+
403
+ text = "Hello my name is"
404
+ inputs = tokenizer(text, return_tensors="pt")
405
+
406
+ outputs = model.generate(**inputs, max_new_tokens=20)
407
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
408
+ ```
409
+
410
+ By default, transformers will load the model in full precision. Therefore you might be interested to further reduce down the memory requirements to run the model through the optimizations we offer in HF ecosystem:
411
+
412
+ ### In half-precision
413
+
414
+ Note `float16` precision only works on GPU devices
415
+
416
+ <details>
417
+ <summary> Click to expand </summary>
418
+
419
+ ```diff
420
+ + import torch
421
+ from transformers import AutoModelForCausalLM, AutoTokenizer
422
+
423
+ model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
424
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
425
+
426
+ + model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
427
+
428
+ text = "Hello my name is"
429
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
430
+
431
+ outputs = model.generate(**inputs, max_new_tokens=20)
432
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
433
+ ```
434
+ </details>
435
+
436
+ ### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
437
+
438
+ <details>
439
+ <summary> Click to expand </summary>
440
+
441
+ ```diff
442
+ + import torch
443
+ from transformers import AutoModelForCausalLM, AutoTokenizer
444
+
445
+ model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
446
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
447
+
448
+ + model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
449
+
450
+ text = "Hello my name is"
451
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
452
+
453
+ outputs = model.generate(**inputs, max_new_tokens=20)
454
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
455
+ ```
456
+ </details>
457
+
458
+ ### Load the model with Flash Attention 2
459
+
460
+ <details>
461
+ <summary> Click to expand </summary>
462
+
463
+ ```diff
464
+ + import torch
465
+ from transformers import AutoModelForCausalLM, AutoTokenizer
466
+
467
+ model_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
468
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
469
+
470
+ + model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
471
+
472
+ text = "Hello my name is"
473
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
474
+
475
+ outputs = model.generate(**inputs, max_new_tokens=20)
476
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
477
+ ```
478
+ </details>
479
+
480
+ ## Limitations
481
+
482
+ The Mixtral-8x7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance.
483
+ It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
484
+ make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
485
+
486
+ # The Mistral AI Team
487
+ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Blanche Savary, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Emma Bou Hanna, Florian Bressand, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Lélio Renard Lavaud, Louis Ternon, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Théophile Gervet, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed.
config.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/workspace/process/mistralai_mixtral-8x7b-instruct-v0.1/source",
3
+ "architectures": [
4
+ "MixtralForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "eos_token_id": 2,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 4096,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 14336,
13
+ "max_position_embeddings": 32768,
14
+ "model_type": "mixtral",
15
+ "num_attention_heads": 32,
16
+ "num_experts_per_tok": 2,
17
+ "num_hidden_layers": 32,
18
+ "num_key_value_heads": 8,
19
+ "num_local_experts": 8,
20
+ "output_router_logits": false,
21
+ "pad_token_id": 0,
22
+ "pretraining_tp": 1,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_theta": 1000000.0,
25
+ "router_aux_loss_coef": 0.02,
26
+ "sliding_window": 4096,
27
+ "tie_word_embeddings": false,
28
+ "torch_dtype": "bfloat16",
29
+ "transformers_version": "4.36.0",
30
+ "use_cache": true,
31
+ "vocab_size": 32000,
32
+ "quantization_config": {
33
+ "bits": 4,
34
+ "modules_in_block_to_quantize" : [
35
+ ["self_attn.k_proj", "self_attn.v_proj", "self_attn.q_proj"],
36
+ ["self_attn.o_proj"],
37
+ ["block_sparse_moe.experts.0.w1", "block_sparse_moe.experts.0.w2", "block_sparse_moe.experts.0.w3"],
38
+ ["block_sparse_moe.experts.1.w1", "block_sparse_moe.experts.1.w2", "block_sparse_moe.experts.1.w3"],
39
+ ["block_sparse_moe.experts.2.w1", "block_sparse_moe.experts.2.w2", "block_sparse_moe.experts.2.w3"],
40
+ ["block_sparse_moe.experts.3.w1", "block_sparse_moe.experts.3.w2", "block_sparse_moe.experts.3.w3"],
41
+ ["block_sparse_moe.experts.4.w1", "block_sparse_moe.experts.4.w2", "block_sparse_moe.experts.4.w3"],
42
+ ["block_sparse_moe.experts.5.w1", "block_sparse_moe.experts.5.w2", "block_sparse_moe.experts.5.w3"],
43
+ ["block_sparse_moe.experts.6.w1", "block_sparse_moe.experts.6.w2", "block_sparse_moe.experts.6.w3"],
44
+ ["block_sparse_moe.experts.7.w1", "block_sparse_moe.experts.7.w2", "block_sparse_moe.experts.7.w3"]],
45
+ "group_size": -1,
46
+ "damp_percent": 0.1,
47
+ "desc_act": true,
48
+ "sym": true,
49
+ "true_sequential": true,
50
+ "model_name_or_path": null,
51
+ "model_file_base_name": "model",
52
+ "quant_method": "gptq"
53
+ }
54
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.36.0.dev0"
6
+ }
gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
quantize_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 4,
3
+ "group_size": -1,
4
+ "damp_percent": 0.1,
5
+ "desc_act": true,
6
+ "sym": true,
7
+ "true_sequential": true,
8
+ "model_name_or_path": null,
9
+ "model_file_base_name": "model"
10
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "eos_token": "</s>",
4
+ "unk_token": "<unk>"
5
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<unk>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<s>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ }
29
+ },
30
+ "additional_special_tokens": [],
31
+ "bos_token": "<s>",
32
+ "clean_up_tokenization_spaces": false,
33
+ "eos_token": "</s>",
34
+ "legacy": true,
35
+ "model_max_length": 1000000000000000019884624838656,
36
+ "pad_token": null,
37
+ "sp_model_kwargs": {},
38
+ "spaces_between_special_tokens": false,
39
+ "tokenizer_class": "LlamaTokenizer",
40
+ "unk_token": "<unk>",
41
+ "use_default_system_prompt": false,
42
+ "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token}}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}"
43
+ }