andrijdavid
commited on
Commit
•
dd2fd58
1
Parent(s):
92868ce
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
@@ -26,6 +26,7 @@ model-index:
|
|
26 |
- type: acc_norm
|
27 |
value: 70.48
|
28 |
name: normalized accuracy
|
|
|
29 |
source:
|
30 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
31 |
name: Open LLM Leaderboard
|
@@ -42,6 +43,7 @@ model-index:
|
|
42 |
- type: acc_norm
|
43 |
value: 88.73
|
44 |
name: normalized accuracy
|
|
|
45 |
source:
|
46 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
47 |
name: Open LLM Leaderboard
|
@@ -59,6 +61,7 @@ model-index:
|
|
59 |
- type: acc
|
60 |
value: 77.81
|
61 |
name: accuracy
|
|
|
62 |
source:
|
63 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
64 |
name: Open LLM Leaderboard
|
@@ -75,6 +78,7 @@ model-index:
|
|
75 |
metrics:
|
76 |
- type: mc2
|
77 |
value: 51.08
|
|
|
78 |
source:
|
79 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
80 |
name: Open LLM Leaderboard
|
@@ -92,6 +96,7 @@ model-index:
|
|
92 |
- type: acc
|
93 |
value: 84.53
|
94 |
name: accuracy
|
|
|
95 |
source:
|
96 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
97 |
name: Open LLM Leaderboard
|
@@ -109,6 +114,7 @@ model-index:
|
|
109 |
- type: acc
|
110 |
value: 74.15
|
111 |
name: accuracy
|
|
|
112 |
source:
|
113 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
114 |
name: Open LLM Leaderboard
|
@@ -141,6 +147,21 @@ Here is an incomplete list of clients and libraries that are known to support GG
|
|
141 |
* [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
|
142 |
<!-- README_GGUF.md-about-gguf end -->
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
## How to download GGUF files
|
145 |
|
146 |
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
|
@@ -153,7 +174,7 @@ The following clients/libraries will automatically download models for you, prov
|
|
153 |
|
154 |
### In `text-generation-webui`
|
155 |
|
156 |
-
Under Download Model, you can enter the model repo:
|
157 |
|
158 |
Then click Download.
|
159 |
|
@@ -168,7 +189,16 @@ pip3 install huggingface-hub
|
|
168 |
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
169 |
|
170 |
```shell
|
171 |
-
huggingface-cli download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
```
|
173 |
|
174 |
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).
|
@@ -176,17 +206,17 @@ For more documentation on downloading with `huggingface-cli`, please see: [HF ->
|
|
176 |
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
177 |
|
178 |
```shell
|
179 |
-
pip3 install hf_transfer
|
180 |
```
|
181 |
|
182 |
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
183 |
|
184 |
```shell
|
185 |
-
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download
|
186 |
```
|
187 |
|
188 |
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
189 |
-
|
190 |
<!-- README_GGUF.md-how-to-download end -->
|
191 |
<!-- README_GGUF.md-how-to-run start -->
|
192 |
## Example `llama.cpp` command
|
@@ -194,12 +224,12 @@ Windows Command Line users: You can set the environment variable by running `set
|
|
194 |
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
195 |
|
196 |
```shell
|
197 |
-
./main -ngl 35 -m
|
198 |
```
|
199 |
|
200 |
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
201 |
|
202 |
-
Change `-c
|
203 |
|
204 |
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
205 |
|
@@ -245,7 +275,7 @@ pip install llama-cpp-python
|
|
245 |
from llama_cpp import Llama
|
246 |
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
247 |
llm = Llama(
|
248 |
-
model_path="./
|
249 |
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
250 |
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
251 |
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
|
@@ -258,7 +288,7 @@ output = llm(
|
|
258 |
echo=True # Whether to echo the prompt
|
259 |
)
|
260 |
# Chat Completion API
|
261 |
-
llm = Llama(model_path="./
|
262 |
llm.create_chat_completion(
|
263 |
messages = [
|
264 |
{"role": "system", "content": "You are a story writing assistant."},
|
@@ -279,4 +309,118 @@ Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
|
279 |
|
280 |
<!-- README_GGUF.md-how-to-run end -->
|
281 |
|
282 |
-
<!-- footer end -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
- type: acc_norm
|
27 |
value: 70.48
|
28 |
name: normalized accuracy
|
29 |
+
verified: false
|
30 |
source:
|
31 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
32 |
name: Open LLM Leaderboard
|
|
|
43 |
- type: acc_norm
|
44 |
value: 88.73
|
45 |
name: normalized accuracy
|
46 |
+
verified: false
|
47 |
source:
|
48 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
49 |
name: Open LLM Leaderboard
|
|
|
61 |
- type: acc
|
62 |
value: 77.81
|
63 |
name: accuracy
|
64 |
+
verified: false
|
65 |
source:
|
66 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
67 |
name: Open LLM Leaderboard
|
|
|
78 |
metrics:
|
79 |
- type: mc2
|
80 |
value: 51.08
|
81 |
+
verified: false
|
82 |
source:
|
83 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
84 |
name: Open LLM Leaderboard
|
|
|
96 |
- type: acc
|
97 |
value: 84.53
|
98 |
name: accuracy
|
99 |
+
verified: false
|
100 |
source:
|
101 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
102 |
name: Open LLM Leaderboard
|
|
|
114 |
- type: acc
|
115 |
value: 74.15
|
116 |
name: accuracy
|
117 |
+
verified: false
|
118 |
source:
|
119 |
url: https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=mistral-community/Mixtral-8x22B-v0.1
|
120 |
name: Open LLM Leaderboard
|
|
|
147 |
* [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
|
148 |
<!-- README_GGUF.md-about-gguf end -->
|
149 |
|
150 |
+
<!-- compatibility_gguf start -->
|
151 |
+
## Explanation of quantisation methods
|
152 |
+
<details>
|
153 |
+
<summary>Click to see details</summary>
|
154 |
+
The new methods available are:
|
155 |
+
|
156 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
157 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
158 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
159 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
160 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw.
|
161 |
+
</details>
|
162 |
+
<!-- compatibility_gguf end -->
|
163 |
+
|
164 |
+
<!-- README_GGUF.md-how-to-download start -->
|
165 |
## How to download GGUF files
|
166 |
|
167 |
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
|
|
|
174 |
|
175 |
### In `text-generation-webui`
|
176 |
|
177 |
+
Under Download Model, you can enter the model repo: LiteLLMs/Mixtral-8x22B-v0.1-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
|
178 |
|
179 |
Then click Download.
|
180 |
|
|
|
189 |
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
190 |
|
191 |
```shell
|
192 |
+
huggingface-cli download LiteLLMs/Mixtral-8x22B-v0.1-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
193 |
+
```
|
194 |
+
|
195 |
+
<details>
|
196 |
+
<summary>More advanced huggingface-cli download usage (click to read)</summary>
|
197 |
+
|
198 |
+
You can also download multiple files at once with a pattern:
|
199 |
+
|
200 |
+
```shell
|
201 |
+
huggingface-cli download LiteLLMs/Mixtral-8x22B-v0.1-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
202 |
```
|
203 |
|
204 |
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).
|
|
|
206 |
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
207 |
|
208 |
```shell
|
209 |
+
pip3 install huggingface_hub[hf_transfer]
|
210 |
```
|
211 |
|
212 |
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
213 |
|
214 |
```shell
|
215 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Mixtral-8x22B-v0.1-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
216 |
```
|
217 |
|
218 |
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
219 |
+
</details>
|
220 |
<!-- README_GGUF.md-how-to-download end -->
|
221 |
<!-- README_GGUF.md-how-to-run start -->
|
222 |
## Example `llama.cpp` command
|
|
|
224 |
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
225 |
|
226 |
```shell
|
227 |
+
./main -ngl 35 -m Q4_0/Q4_0-00001-of-00009.gguf --color -c 65536 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
|
228 |
```
|
229 |
|
230 |
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
231 |
|
232 |
+
Change `-c 65536` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
|
233 |
|
234 |
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
235 |
|
|
|
275 |
from llama_cpp import Llama
|
276 |
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
277 |
llm = Llama(
|
278 |
+
model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
|
279 |
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
280 |
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
281 |
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
|
|
|
288 |
echo=True # Whether to echo the prompt
|
289 |
)
|
290 |
# Chat Completion API
|
291 |
+
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
|
292 |
llm.create_chat_completion(
|
293 |
messages = [
|
294 |
{"role": "system", "content": "You are a story writing assistant."},
|
|
|
309 |
|
310 |
<!-- README_GGUF.md-how-to-run end -->
|
311 |
|
312 |
+
<!-- footer end -->
|
313 |
+
|
314 |
+
<!-- original-model-card start -->
|
315 |
+
# Original model card: Mixtral-8x22B-v0.1
|
316 |
+
|
317 |
+
# Mixtral-8x22B
|
318 |
+
|
319 |
+
> [!TIP]
|
320 |
+
> MistralAI has uploaded weights to their organization at [mistralai/Mixtral-8x22B-v0.1](https://huggingface.co/mistralai/Mixtral-8x22B-v0.1) and [mistralai/Mixtral-8x22B-Instruct-v0.1](https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1) too.
|
321 |
+
|
322 |
+
> [!TIP]
|
323 |
+
> Kudos to [@v2ray](https://huggingface.co/v2ray) for converting the checkpoints and uploading them in `transformers` compatible format. Go give them a follow!
|
324 |
+
|
325 |
+
Converted to HuggingFace Transformers format using the script [here](https://huggingface.co/v2ray/Mixtral-8x22B-v0.1/blob/main/convert.py).
|
326 |
+
|
327 |
+
The Mixtral-8x22B Large Language Model (LLM) is a pretrained generative Sparse Mixture of Experts.
|
328 |
+
## Run the model
|
329 |
+
```python
|
330 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
331 |
+
|
332 |
+
model_id = "mistral-community/Mixtral-8x22B-v0.1"
|
333 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
334 |
+
|
335 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
336 |
+
|
337 |
+
text = "Hello my name is"
|
338 |
+
inputs = tokenizer(text, return_tensors="pt")
|
339 |
+
|
340 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
341 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
342 |
+
```
|
343 |
+
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:
|
344 |
+
### In half-precision
|
345 |
+
Note `float16` precision only works on GPU devices
|
346 |
+
<details>
|
347 |
+
<summary> Click to expand </summary>
|
348 |
+
|
349 |
+
```diff
|
350 |
+
+ import torch
|
351 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
352 |
+
|
353 |
+
model_id = "mistral-community/Mixtral-8x22B-v0.1"
|
354 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
355 |
+
|
356 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).to(0)
|
357 |
+
|
358 |
+
text = "Hello my name is"
|
359 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
360 |
+
|
361 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
362 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
363 |
+
```
|
364 |
+
</details>
|
365 |
+
|
366 |
+
### Lower precision using (8-bit & 4-bit) using `bitsandbytes`
|
367 |
+
<details>
|
368 |
+
<summary> Click to expand </summary>
|
369 |
+
|
370 |
+
```diff
|
371 |
+
+ import torch
|
372 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
373 |
+
|
374 |
+
model_id = "mistral-community/Mixtral-8x22B-v0.1"
|
375 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
376 |
+
|
377 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True)
|
378 |
+
|
379 |
+
text = "Hello my name is"
|
380 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
381 |
+
|
382 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
383 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
384 |
+
```
|
385 |
+
</details>
|
386 |
+
|
387 |
+
### Load the model with Flash Attention 2
|
388 |
+
<details>
|
389 |
+
<summary> Click to expand </summary>
|
390 |
+
|
391 |
+
```diff
|
392 |
+
+ import torch
|
393 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
394 |
+
|
395 |
+
model_id = "mistral-community/Mixtral-8x22B-v0.1"
|
396 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
397 |
+
|
398 |
+
+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True)
|
399 |
+
|
400 |
+
text = "Hello my name is"
|
401 |
+
+ inputs = tokenizer(text, return_tensors="pt").to(0)
|
402 |
+
|
403 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
404 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
405 |
+
```
|
406 |
+
</details>
|
407 |
+
|
408 |
+
## Notice
|
409 |
+
Mixtral-8x22B-v0.1 is a pretrained base model and therefore does not have any moderation mechanisms.
|
410 |
+
# The Mistral AI Team
|
411 |
+
Albert Jiang, Alexandre Sablayrolles, Alexis Tacnet, Antoine Roux, Arthur Mensch, Audrey Herblin-Stoop, Baptiste Bout, Baudouin de Monicault,Blanche Savary, Bam4d, Caroline Feldman, Devendra Singh Chaplot, Diego de las Casas, Eleonore Arcelin, Emma Bou Hanna, Etienne Metzger, Gianna Lengyel, Guillaume Bour, Guillaume Lample, Harizo Rajaona, Jean-Malo Delignon, Jia Li, Justus Murke, Louis Martin, Louis Ternon, Lucile Saulnier, Lélio Renard Lavaud, Margaret Jennings, Marie Pellat, Marie Torelli, Marie-Anne Lachaux, Nicolas Schuhl, Patrick von Platen, Pierre Stock, Sandeep Subramanian, Sophia Yang, Szymon Antoniak, Teven Le Scao, Thibaut Lavril, Timothée Lacroix, Théophile Gervet, Thomas Wang, Valera Nemychnikova, William El Sayed, William Marshall.
|
412 |
+
# [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
|
413 |
+
Detailed results can be found [here](https://huggingface.co/datasets/open-llm-leaderboard/details_mistral-community__Mixtral-8x22B-v0.1)
|
414 |
+
|
415 |
+
| Metric | Value |
|
416 |
+
| -: |
|
417 |
+
| Avg. | 74.46 |
|
418 |
+
| AI2 Reasoning Challenge (25-Shot) | 70.48 |
|
419 |
+
| HellaSwag (10-Shot) | 88.73 |
|
420 |
+
| MMLU (5-Shot) | 77.81 |
|
421 |
+
| TruthfulQA (0-shot) | 51.08 |
|
422 |
+
| Winogrande (5-shot) | 84.53 |
|
423 |
+
| GSM8k (5-shot) | 74.15 |
|
424 |
+
|
425 |
+
|
426 |
+
<!-- original-model-card end -->
|