Model Intelligence Sheet
richarderkhov/mistralai_-_mixtral-8x7b-instruct-v0.1-gguf overview
Tokenization with mistral-common
Downloads
233
Likes
0
Pipeline
—
Library
—
Visibility
Public
Access
Open
Repository Files & Downloads
20 files detected
Direct downloads for all repository files
| File | Type | Quantization | Size | Link |
|---|---|---|---|---|
| Mixtral-8x7B-Instruct-v0.1.IQ4_NL.gguf | GGUF | IQ4_NL | 24.91 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.IQ4_XS.gguf | GGUF | IQ4_XS | 23.63 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q2_K.gguf | GGUF | Q2_K | 16.12 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q3_K.gguf | GGUF | Q3_K | 21.00 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q3_K_L.gguf | GGUF | Q3_K_L | 22.51 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q3_K_M.gguf | GGUF | Q3_K_M | 21.00 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q3_K_S.gguf | GGUF | Q3_K_S | 19.03 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q4_0.gguf | GGUF | — | 24.63 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q4_1.gguf | GGUF | — | 27.32 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q4_K.gguf | GGUF | Q4_K | 26.49 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q4_K_M.gguf | GGUF | Q4_K_M | 26.49 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q4_K_S.gguf | GGUF | Q4_K_S | 24.91 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q5_0.gguf | GGUF | — | 30.02 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q5_1.gguf | GGUF | — | 32.71 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q5_K.gguf | GGUF | Q5_K | 30.95 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q5_K_M.gguf | GGUF | Q5_K_M | 30.95 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q5_K_S.gguf | GGUF | Q5_K_S | 30.02 GB | Download |
| Mixtral-8x7B-Instruct-v0.1.Q6_K.gguf | GGUF | Q6_K | 35.74 GB | Download |
| Mixtral-8x7B-Instruct-v0.1_Q8_0-00001-of-00002.gguf | GGUF | — | 37.01 GB | Download |
| Mixtral-8x7B-Instruct-v0.1_Q8_0-00002-of-00002.gguf | GGUF | — | 9.21 GB | Download |
Model Details Live
Metadata Inspector
Normalized metadata (stored in metadata_json)
{
"metadata": {},
"card_data": {
"frontmatter": {},
"hero_image_url": "",
"summary": "### Tokenization with mistral-common ``py from mistral_common.tokens.tokenizers.mistral import MistralTokenizer from mistral_common.protocol.instruct.messages import UserMessage from mistral_common.protocol.instruct.request import ChatCompletionRequest mistral_models_path = \"MISTRAL_MODELS_PATH\" tokenizer = MistralTokenizer.v1() completion_request = ChatCompletionRequest(messages=[UserMessage(content=\"Explain Machine Learning to me in a nutshell.\")]) tokens = tokenizer.encode_chat_completion(completion_request).tokens ``",
"quick_links": [],
"benchmark_table_html": "",
"readme_markdown": "Quantization made by Richard Erkhov.\n\n[Github](https://github.com/RichardErkhov)\n\n[Discord](https://discord.gg/pvy7H8DZMG)\n\n[Request more models](https://github.com/RichardErkhov/quant_request)\n\n\nMixtral-8x7B-Instruct-v0.1 - GGUF\n- Model creator: https://huggingface.co/mistralai/\n- Original model: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1/\n\n\n| Name | Quant method | Size |\n| ---- | ---- | ---- |\n| [Mixtral-8x7B-Instruct-v0.1.Q2_K.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q2_K.gguf) | Q2_K | 16.12GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q3_K_S.gguf) | Q3_K_S | 19.03GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q3_K.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q3_K.gguf) | Q3_K | 21.0GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q3_K_M.gguf) | Q3_K_M | 21.0GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q3_K_L.gguf) | Q3_K_L | 22.51GB |\n| [Mixtral-8x7B-Instruct-v0.1.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.IQ4_XS.gguf) | IQ4_XS | 23.63GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q4_0.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q4_0.gguf) | Q4_0 | 24.63GB |\n| [Mixtral-8x7B-Instruct-v0.1.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.IQ4_NL.gguf) | IQ4_NL | 24.91GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q4_K_S.gguf) | Q4_K_S | 24.91GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q4_K.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q4_K.gguf) | Q4_K | 26.49GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q4_K_M.gguf) | Q4_K_M | 26.49GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q4_1.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q4_1.gguf) | Q4_1 | 27.32GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q5_0.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q5_0.gguf) | Q5_0 | 30.02GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q5_K_S.gguf) | Q5_K_S | 30.02GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q5_K.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q5_K.gguf) | Q5_K | 30.95GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q5_K_M.gguf) | Q5_K_M | 30.95GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q5_1.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q5_1.gguf) | Q5_1 | 32.71GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q6_K.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/blob/main/Mixtral-8x7B-Instruct-v0.1.Q6_K.gguf) | Q6_K | 35.74GB |\n| [Mixtral-8x7B-Instruct-v0.1.Q8_0.gguf](https://huggingface.co/RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf/tree/main/) | Q8_0 | 46.22GB |\n\n\n\n\nOriginal model description:\n---\nlanguage:\n- fr\n- it\n- de\n- es\n- en\nlicense: apache-2.0\nbase_model: mistralai/Mixtral-8x7B-v0.1\ninference:\n parameters:\n temperature: 0.5\nwidget:\n- messages:\n - role: user\n content: What is your favorite condiment?\n\nextra_gated_description: If you want to learn more about how we process your personal data, please read our <a href=\"https://mistral.ai/terms/\">Privacy Policy</a>.\n---\n# Model Card for Mixtral-8x7B\n\n### Tokenization with `mistral-common`\n\n```py\nfrom mistral_common.tokens.tokenizers.mistral import MistralTokenizer\nfrom mistral_common.protocol.instruct.messages import UserMessage\nfrom mistral_common.protocol.instruct.request import ChatCompletionRequest\n \nmistral_models_path = \"MISTRAL_MODELS_PATH\"\n \ntokenizer = MistralTokenizer.v1()\n \ncompletion_request = ChatCompletionRequest(messages=[UserMessage(content=\"Explain Machine Learning to me in a nutshell.\")])\n \ntokens = tokenizer.encode_chat_completion(completion_request).tokens\n```\n \n## Inference with `mistral_inference`\n \n ```py\nfrom mistral_inference.transformer import Transformer\nfrom mistral_inference.generate import generate\n \nmodel = Transformer.from_folder(mistral_models_path)\nout_tokens, _ = generate([tokens], model, max_tokens=64, temperature=0.0, eos_id=tokenizer.instruct_tokenizer.tokenizer.eos_id)\n\nresult = tokenizer.decode(out_tokens[0])\n\nprint(result)\n```\n\n## Inference with hugging face `transformers`\n \n```py\nfrom transformers import AutoModelForCausalLM\n \nmodel = AutoModelForCausalLM.from_pretrained(\"mistralai/Mixtral-8x7B-Instruct-v0.1\")\nmodel.to(\"cuda\")\n \ngenerated_ids = model.generate(tokens, max_new_tokens=1000, do_sample=True)\n\n# decode with mistral tokenizer\nresult = tokenizer.decode(generated_ids[0].tolist())\nprint(result)\n```\n\n> [!TIP]\n> PRs to correct the transformers tokenizer so that it gives 1-to-1 the same results as the mistral-common reference implementation are very welcome!\n \n \n---\nThe 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.\n\nFor full details of this model please read our [release blog post](https://mistral.ai/news/mixtral-of-experts/).\n\n## Warning\nThis 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.\n\n## Instruction format\n\nThis format must be strictly respected, otherwise the model will generate sub-optimal outputs.\n\nThe template used to build a prompt for the Instruct model is defined as follows:\n```\n<s> [INST] Instruction [/INST] Model answer</s> [INST] Follow-up instruction [/INST]\n```\nNote that `<s>` and `</s>` are special tokens for beginning of string (BOS) and end of string (EOS) while [INST] and [/INST] are regular strings.\n\nAs reference, here is the pseudo-code used to tokenize instructions during fine-tuning:\n```python\ndef tokenize(text):\n return tok.encode(text, add_special_tokens=False)\n\n[BOS_ID] + \ntokenize(\"[INST]\") + tokenize(USER_MESSAGE_1) + tokenize(\"[/INST]\") +\ntokenize(BOT_MESSAGE_1) + [EOS_ID] +\n…\ntokenize(\"[INST]\") + tokenize(USER_MESSAGE_N) + tokenize(\"[/INST]\") +\ntokenize(BOT_MESSAGE_N) + [EOS_ID]\n```\n\nIn the pseudo-code above, note that the `tokenize` method should not add a BOS or EOS token automatically, but should add a prefix space. \n\nIn the Transformers library, one can use [chat templates](https://huggingface.co/docs/transformers/main/en/chat_templating) which make sure the right format is applied.\n\n## Run the model\n\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nmodel_id = \"mistralai/Mixtral-8x7B-Instruct-v0.1\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\n\nmodel = AutoModelForCausalLM.from_pretrained(model_id, device_map=\"auto\")\n\nmessages = [\n {\"role\": \"user\", \"content\": \"What is your favourite condiment?\"},\n {\"role\": \"assistant\", \"content\": \"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!\"},\n {\"role\": \"user\", \"content\": \"Do you have mayonnaise recipes?\"}\n]\n\ninputs = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(\"cuda\")\n\noutputs = model.generate(inputs, max_new_tokens=20)\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n```\n\nBy 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:\n\n### In half-precision\n\nNote `float16` precision only works on GPU devices\n\n<details>\n<summary> Click to expand </summary>\n\n```diff\n+ import torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nmodel_id = \"mistralai/Mixtral-8x7B-Instruct-v0.1\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\n\n+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map=\"auto\")\n\nmessages = [\n {\"role\": \"user\", \"content\": \"What is your favourite condiment?\"},\n {\"role\": \"assistant\", \"content\": \"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!\"},\n {\"role\": \"user\", \"content\": \"Do you have mayonnaise recipes?\"}\n]\n\ninput_ids = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(\"cuda\")\n\noutputs = model.generate(input_ids, max_new_tokens=20)\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n```\n</details>\n\n### Lower precision using (8-bit & 4-bit) using `bitsandbytes`\n\n<details>\n<summary> Click to expand </summary>\n\n```diff\n+ import torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nmodel_id = \"mistralai/Mixtral-8x7B-Instruct-v0.1\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\n\n+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, device_map=\"auto\")\n\ntext = \"Hello my name is\"\nmessages = [\n {\"role\": \"user\", \"content\": \"What is your favourite condiment?\"},\n {\"role\": \"assistant\", \"content\": \"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!\"},\n {\"role\": \"user\", \"content\": \"Do you have mayonnaise recipes?\"}\n]\n\ninput_ids = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(\"cuda\")\n\noutputs = model.generate(input_ids, max_new_tokens=20)\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n```\n</details>\n\n### Load the model with Flash Attention 2\n\n<details>\n<summary> Click to expand </summary>\n\n```diff\n+ import torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nmodel_id = \"mistralai/Mixtral-8x7B-Instruct-v0.1\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\n\n+ model = AutoModelForCausalLM.from_pretrained(model_id, use_flash_attention_2=True, device_map=\"auto\")\n\nmessages = [\n {\"role\": \"user\", \"content\": \"What is your favourite condiment?\"},\n {\"role\": \"assistant\", \"content\": \"Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!\"},\n {\"role\": \"user\", \"content\": \"Do you have mayonnaise recipes?\"}\n]\n\ninput_ids = tokenizer.apply_chat_template(messages, return_tensors=\"pt\").to(\"cuda\")\n\noutputs = model.generate(input_ids, max_new_tokens=20)\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n```\n</details>\n\n## Limitations\n\nThe Mixtral-8x7B Instruct model is a quick demonstration that the base model can be easily fine-tuned to achieve compelling performance. \nIt does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to\nmake the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.\n\n# The Mistral AI Team\nAlbert 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.\n\n",
"related_quantizations": []
},
"tags": [
"gguf",
"endpoints_compatible",
"region:us",
"conversational"
],
"likes": 0,
"downloads": 233,
"gated": false,
"private": false,
"last_modified": "2024-11-10T03:53:18.000Z",
"created_at": "2024-11-09T16:17:57.000Z",
"pipeline_tag": "",
"library_name": ""
}
Source payload excerpt (from Hugging Face API)
{
"_id": "672f8b352fa804d7facfe4dc",
"id": "RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf",
"modelId": "RichardErkhov/mistralai_-_Mixtral-8x7B-Instruct-v0.1-gguf",
"sha": "468d5dccbb843c5c7fe7e2dab8669ea3581976b3",
"createdAt": "2024-11-09T16:17:57.000Z",
"lastModified": "2024-11-10T03:53:18.000Z",
"author": "RichardErkhov",
"downloads": 233,
"likes": 0,
"gated": false,
"private": false,
"pipeline_tag": "",
"library_name": "",
"siblings_count": 22
}