marcsun13 HF staff TheBloke commited on
Commit
0018ff5
0 Parent(s):

Duplicate from TheBloke/Mixtral-8x7B-v0.1-GPTQ

Browse files

Co-authored-by: Tom Jobbins <TheBloke@users.noreply.huggingface.co>

.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
README.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistralai/Mixtral-8x7B-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 v0.1
13
+ model_type: mixtral
14
+ prompt_template: '{prompt}
15
+
16
+ '
17
+ quantized_by: TheBloke
18
+ ---
19
+ <!-- markdownlint-disable MD041 -->
20
+
21
+ <!-- header start -->
22
+ <!-- 200823 -->
23
+ <div style="width: auto; margin-left: auto; margin-right: auto">
24
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
25
+ </div>
26
+ <div style="display: flex; justify-content: space-between; width: 100%;">
27
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
28
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
29
+ </div>
30
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
31
+ <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>
32
+ </div>
33
+ </div>
34
+ <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>
35
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
36
+ <!-- header end -->
37
+
38
+ # Mixtral 8X7B v0.1 - GPTQ
39
+ - Model creator: [Mistral AI_](https://huggingface.co/mistralai)
40
+ - Original model: [Mixtral 8X7B v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1)
41
+
42
+ <!-- description start -->
43
+ # Description
44
+
45
+ This repo contains **EXPERIMENTAL** GPTQ model files for [Mistral AI_'s Mixtral 8X7B v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1).
46
+
47
+ ## Requires AutoGPTQ PR
48
+
49
+ These files were made with, and will currently only work with, this AutoGPTQ PR: https://github.com/LaaZa/AutoGPTQ/tree/Mixtral
50
+
51
+ To test, please build AutoGPTQ from source using that PR.
52
+
53
+ Updates for Transformers support are expected soon.
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
+ <!-- description end -->
58
+ <!-- repositories-available start -->
59
+ ## Repositories available
60
+
61
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Mixtral-8x7B-v0.1-GPTQ)
62
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Mixtral-8x7B-v0.1-GGUF)
63
+ * [Mistral AI_'s original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1)
64
+ <!-- repositories-available end -->
65
+
66
+ <!-- prompt-template start -->
67
+ ## Prompt template: None
68
+
69
+ ```
70
+ {prompt}
71
+
72
+ ```
73
+
74
+ <!-- prompt-template end -->
75
+
76
+
77
+ <!-- README_GPTQ.md-provided-files start -->
78
+ ## Provided files, and GPTQ parameters
79
+
80
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
81
+
82
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
83
+
84
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
85
+
86
+ <details>
87
+ <summary>Explanation of GPTQ parameters</summary>
88
+
89
+ - Bits: The bit size of the quantised model.
90
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
91
+ - 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.
92
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
93
+ - 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).
94
+ - 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.
95
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
96
+
97
+ </details>
98
+
99
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
100
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
101
+ | main | 4 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 23.81 GB | No | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
102
+ | gptq-4bit-128g-actorder_True | 4 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 24.70 GB | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
103
+ | gptq-4bit-32g-actorder_True | 4 | 32 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 27.42 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
104
+ | gptq-3bit--1g-actorder_True | 3 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 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. |
105
+ | gptq-3bit-128g-actorder_True | 3 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 18.85 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
106
+ | gptq-8bit--1g-actorder_True | 8 | None | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 47.04 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
107
+ | gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | [VMware Open Instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 48.10 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
108
+
109
+ <!-- README_GPTQ.md-provided-files end -->
110
+
111
+ <!-- README_GPTQ.md-download-from-branches start -->
112
+ ## How to download, including from branches
113
+
114
+ ### In text-generation-webui
115
+
116
+ To download from the `main` branch, enter `TheBloke/Mixtral-8x7B-v0.1-GPTQ` in the "Download model" box.
117
+
118
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/Mixtral-8x7B-v0.1-GPTQ:gptq-4bit-128g-actorder_True`
119
+
120
+ ### From the command line
121
+
122
+ I recommend using the `huggingface-hub` Python library:
123
+
124
+ ```shell
125
+ pip3 install huggingface-hub
126
+ ```
127
+
128
+ To download the `main` branch to a folder called `Mixtral-8x7B-v0.1-GPTQ`:
129
+
130
+ ```shell
131
+ mkdir Mixtral-8x7B-v0.1-GPTQ
132
+ huggingface-cli download TheBloke/Mixtral-8x7B-v0.1-GPTQ --local-dir Mixtral-8x7B-v0.1-GPTQ --local-dir-use-symlinks False
133
+ ```
134
+
135
+ To download from a different branch, add the `--revision` parameter:
136
+
137
+ ```shell
138
+ mkdir Mixtral-8x7B-v0.1-GPTQ
139
+ huggingface-cli download TheBloke/Mixtral-8x7B-v0.1-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir Mixtral-8x7B-v0.1-GPTQ --local-dir-use-symlinks False
140
+ ```
141
+
142
+ <details>
143
+ <summary>More advanced huggingface-cli download usage</summary>
144
+
145
+ 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.
146
+
147
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
148
+
149
+ 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).
150
+
151
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
152
+
153
+ ```shell
154
+ pip3 install hf_transfer
155
+ ```
156
+
157
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
158
+
159
+ ```shell
160
+ mkdir Mixtral-8x7B-v0.1-GPTQ
161
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mixtral-8x7B-v0.1-GPTQ --local-dir Mixtral-8x7B-v0.1-GPTQ --local-dir-use-symlinks False
162
+ ```
163
+
164
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
165
+ </details>
166
+
167
+ ### With `git` (**not** recommended)
168
+
169
+ To clone a specific branch with `git`, use a command like this:
170
+
171
+ ```shell
172
+ git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/Mixtral-8x7B-v0.1-GPTQ
173
+ ```
174
+
175
+ 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.)
176
+
177
+ <!-- README_GPTQ.md-download-from-branches end -->
178
+ <!-- README_GPTQ.md-text-generation-webui start -->
179
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
180
+
181
+ **NOTE**: This will only work with the AutoGPTQ loader, and only if you build AutoGPTQ from source using https://github.com/LaaZa/AutoGPTQ/tree/Mixtral
182
+
183
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
184
+
185
+ 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.
186
+
187
+ 1. Click the **Model tab**.
188
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Mixtral-8x7B-v0.1-GPTQ`.
189
+
190
+ - To download from a specific branch, enter for example `TheBloke/Mixtral-8x7B-v0.1-GPTQ:gptq-4bit-128g-actorder_True`
191
+ - see Provided Files above for the list of branches for each option.
192
+
193
+ 3. Click **Download**.
194
+ 4. The model will start downloading. Once it's finished it will say "Done".
195
+ 5. In the top left, click the refresh icon next to **Model**.
196
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Mixtral-8x7B-v0.1-GPTQ`
197
+ 7. The model will automatically load, and is now ready for use!
198
+ 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.
199
+
200
+ - 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`.
201
+
202
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
203
+
204
+ <!-- README_GPTQ.md-text-generation-webui end -->
205
+
206
+ <!-- README_GPTQ.md-use-from-python start -->
207
+ ## Python code example: inference from this GPTQ model
208
+
209
+ ### Install the necessary packages
210
+
211
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
212
+
213
+ ```shell
214
+ pip3 install --upgrade transformers optimum
215
+ # If using PyTorch 2.1 + CUDA 12.x:
216
+ pip3 install --upgrade auto-gptq
217
+ # or, if using PyTorch 2.1 + CUDA 11.x:
218
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
219
+ ```
220
+
221
+ 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:
222
+
223
+ ```shell
224
+ pip3 uninstall -y auto-gptq
225
+ git clone https://github.com/PanQiWei/AutoGPTQ
226
+ cd AutoGPTQ
227
+ git checkout v0.5.1
228
+ pip3 install .
229
+ ```
230
+
231
+ ### Example Python code
232
+
233
+ ```python
234
+ from transformers import AutoTokenizer
235
+ from auto_gptq import AutoGPTQForCausalLM
236
+
237
+ model_name_or_path = "TheBloke/Mixtral-8x7B-v0.1-GPTQ"
238
+
239
+ model_name_or_path = args.model_dir
240
+ # To use a different branch, change revision
241
+ # For example: revision="gptq-4bit-32g-actorder_True"
242
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
243
+ model_basename="model",
244
+ use_safetensors=True,
245
+ trust_remote_code=False,
246
+ device="cuda:0",
247
+ use_triton=False,
248
+ disable_exllama=True,
249
+ disable_exllamav2=True,
250
+ quantize_config=None)
251
+
252
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True, trust_remote_code=False)
253
+
254
+ prompt = "Tell me about AI"
255
+ prompt_template=f'''{prompt}'''
256
+
257
+ print("\n\n*** Generate:")
258
+
259
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
260
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
261
+ print(tokenizer.decode(output[0]))
262
+
263
+ ```
264
+ <!-- README_GPTQ.md-use-from-python end -->
265
+
266
+
267
+ <!-- footer start -->
268
+ <!-- 200823 -->
269
+ ## Discord
270
+
271
+ For further support, and discussions on these models and AI in general, join us at:
272
+
273
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
274
+
275
+ ## Thanks, and how to contribute
276
+
277
+ Thanks to the [chirper.ai](https://chirper.ai) team!
278
+
279
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
280
+
281
+ 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.
282
+
283
+ 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.
284
+
285
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
286
+
287
+ * Patreon: https://patreon.com/TheBlokeAI
288
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
289
+
290
+ **Special thanks to**: Aemon Algiz.
291
+
292
+ **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
293
+
294
+
295
+ Thank you to all my generous patrons and donaters!
296
+
297
+ And thank you again to a16z for their generous grant.
298
+
299
+ <!-- footer end -->
300
+
301
+ # Original model card: Mistral AI_'s Mixtral 8X7B v0.1
302
+
303
+ # Model Card for Mixtral-8x7B
304
+ The Mixtral-8x7B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts. The Mistral-8x7B outperforms Llama 2 70B on most benchmarks we tested.
305
+
306
+ For full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-of-experts/).
307
+
308
+ ## Warning
309
+ 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.
310
+
311
+ ## Run the model
312
+
313
+
314
+ ```python
315
+ from transformers import AutoModelForCausalLM, AutoTokenizer
316
+
317
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
318
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
319
+
320
+ model = AutoModelForCausalLM.from_pretrained(model_id)
321
+
322
+ text = "Hello my name is"
323
+ inputs = tokenizer(text, return_tensors="pt")
324
+
325
+ outputs = model.generate(**inputs, max_new_tokens=20)
326
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
327
+ ```
328
+
329
+ 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:
330
+
331
+ ### In half-precision
332
+
333
+ Note `float16` precision only works on GPU devices
334
+
335
+ <details>
336
+ <summary> Click to expand </summary>
337
+
338
+ ```diff
339
+ + import torch
340
+ from transformers import AutoModelForCausalLM, AutoTokenizer
341
+
342
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
343
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
344
+
345
+ + model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
346
+
347
+ text = "Hello my name is"
348
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
349
+
350
+ outputs = model.generate(**inputs, max_new_tokens=20)
351
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
352
+ ```
353
+ </details>
354
+
355
+ ### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
356
+
357
+ <details>
358
+ <summary> Click to expand </summary>
359
+
360
+ ```diff
361
+ + import torch
362
+ from transformers import AutoModelForCausalLM, AutoTokenizer
363
+
364
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
365
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
366
+
367
+ + model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
368
+
369
+ text = "Hello my name is"
370
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
371
+
372
+ outputs = model.generate(**inputs, max_new_tokens=20)
373
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
374
+ ```
375
+ </details>
376
+
377
+ ### Load the model with Flash Attention 2
378
+
379
+ <details>
380
+ <summary> Click to expand </summary>
381
+
382
+ ```diff
383
+ + import torch
384
+ from transformers import AutoModelForCausalLM, AutoTokenizer
385
+
386
+ model_id = "mistralai/Mixtral-8x7B-v0.1"
387
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
388
+
389
+ + model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
390
+
391
+ text = "Hello my name is"
392
+ + inputs = tokenizer(text, return_tensors="pt").to(0)
393
+
394
+ outputs = model.generate(**inputs, max_new_tokens=20)
395
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
396
+ ```
397
+ </details>
398
+
399
+ ## Notice
400
+ Mixtral-8x7B is a pretrained base model and therefore does not have any moderation mechanisms.
401
+
402
+ # The Mistral AI Team
403
+ 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,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/workspace/process/mistralai_mixtral-8x7b-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
+ "group_size": -1,
35
+ "damp_percent": 0.1,
36
+ "desc_act": true,
37
+ "sym": true,
38
+ "true_sequential": true,
39
+ "model_name_or_path": null,
40
+ "model_file_base_name": "model",
41
+ "quant_method": "gptq"
42
+ }
43
+ }
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
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06350f6e939a9ab5abef54a8eae0cbf5d7d04236f2e60f8f53c6c6589ec231a4
3
+ size 23811549344
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.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
3
+ size 493443
tokenizer_config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }