Views
No views yet

[INST] {prompt} [/INST]
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|---|---|---|---|---|---|
| mixtral-fusion-4x7b-instruct-v0.1.Q2_K.gguf | Q2_K | 2 | 8.06 GB | 10.56 GB | smallest, significant quality loss - not recommended for most purposes |
| mixtral-fusion-4x7b-instruct-v0.1.Q3_K_M.gguf | Q3_K_M | 3 | 10.52 GB | 13.02 GB | very small, high quality loss |
| mixtral-fusion-4x7b-instruct-v0.1.Q4_0.gguf | Q4_0 | 4 | 13.62 GB | 16.12 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
| mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf | Q4_K_M | 4 | 13.64 GB | 16.14 GB | medium, balanced quality - recommended |
| mixtral-fusion-4x7b-instruct-v0.1.Q5_0.gguf | Q5_0 | 5 | 16.63 GB | 19.13 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
| mixtral-fusion-4x7b-instruct-v0.1.Q5_K_M.gguf | Q5_K_M | 5 | 16.64 GB | 19.14 GB | large, very low quality loss - recommended |
| mixtral-fusion-4x7b-instruct-v0.1.Q6_K.gguf | Q6_K | 6 | 19.82 GB | 22.32 GB | very large, extremely low quality loss |
| mixtral-fusion-4x7b-instruct-v0.1.Q8_0.gguf | Q8_0 | 8 | 25.67 GB | 28.17 GB | very large, extremely low quality loss - not recommended |
text-generation-webuihuggingface-hub Python library:pip3 install huggingface-hubhuggingface-cli download TheBloke/Mixtral-Fusion-4x7B-Instruct-v0.1-GGUF mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks Falsehuggingface-cli download TheBloke/Mixtral-Fusion-4x7B-Instruct-v0.1-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'huggingface-cli, please see: HF -> Hub Python Library -> Download files -> Download from the CLI.hf_transfer:pip3 install hf_transferHF_HUB_ENABLE_HF_TRANSFER to 1:HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Mixtral-Fusion-4x7B-Instruct-v0.1-GGUF mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks Falseset HF_HUB_ENABLE_HF_TRANSFER=1 before the download command.llama.cpp commandllama.cpp from commit d0cee0d or later../main -ngl 35 -m mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "[INST] {prompt} [/INST]"-ngl 32 to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.-c 32768 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.-p <PROMPT> argument with -i -instext-generation-webui1# Base ctransformers with no GPU acceleration
2pip install llama-cpp-python
3# With NVidia CUDA acceleration
4CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
5# Or with OpenBLAS acceleration
6CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
7# Or with CLBLast acceleration
8CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
9# Or with AMD ROCm GPU acceleration (Linux only)
10CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
11# Or with Metal GPU acceleration for macOS systems only
12CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
13
14# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
15$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
16pip install llama-cpp-python1from llama_cpp import Llama
2
3# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
4llm = Llama(
5 model_path="./mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf", # Download the model file first
6 n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
7 n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
8 n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
9)
10
11# Simple inference example
12output = llm(
13 "[INST] {prompt} [/INST]", # Prompt
14 max_tokens=512, # Generate up to 512 tokens
15 stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
16 echo=True # Whether to echo the prompt
17)
18
19# Chat Completion API
20
21llm = Llama(model_path="./mixtral-fusion-4x7b-instruct-v0.1.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
22llm.create_chat_completion(
23 messages = [
24 {"role": "system", "content": "You are a story writing assistant."},
25 {
26 "role": "user",
27 "content": "Write a story about llamas."
28 }
29 ]
30)1pip install git+https://github.com/huggingface/transformers --upgrade
2pip install torch accelerate bitsandbytes flash_attn1from transformers import AutoTokenizer, AutoModelForCausalLM, MixtralForCausalLM
2import torch
3
4model_name_or_path = "mmnga/Mixtral-Fusion-4x7B-Instruct-v0.1"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
7model = MixtralForCausalLM.from_pretrained(model_name_or_path, load_in_8bit=True)
8
9# set num_experts_per_tok 1 or 2 ?
10model.config.num_experts_per_tok = 2
11
12# message
13messages = [
14 {"role": "user", "content": "Tell me what's for dinner tonight."},
15]
16
17with torch.no_grad():
18 token_ids = tokenizer.apply_chat_template(messages, return_tensors="pt")
19 output_ids = model.generate(
20 token_ids.to(model.device),
21 temperature=0.5,
22 do_sample=True,
23 top_p=0.95,
24 top_k=40,
25 max_new_tokens=128,
26 repetition_penalty=1.5
27 )
28output = tokenizer.decode(output_ids[0][token_ids.size(1) :])
29print(output)
30