How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="keyfan/Mixtral-8x7B-Instruct-2bit")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("keyfan/Mixtral-8x7B-Instruct-2bit")
model = AutoModelForCausalLM.from_pretrained("keyfan/Mixtral-8x7B-Instruct-2bit")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

This is 2-bit quantization of mistralai/Mixtral-8x7B-Instruct-v0.1 using QuIP#

Model loading

Please follow the instruction of QuIP-for-all for usage.

As an alternative, you can use vLLM branch for faster inference. QuIP has to launch like 5 kernels for each linear layer, so it's very helpful for vLLM to use cuda-graph to reduce launching overhead. BTW, If you have problem installing fast-hadamard-transform from pip, you can also install it from source

Perplexity

Measured at Wikitext with 4096 context length

fp16 2-bit
3.8825 5.2799

Speed

Measured with examples/benchmark_latency.py script at vLLM repo. At batch size = 1, it generates at 16.3 tokens/s with single 3090.

Downloads last month
394
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support