Downloads · 30 days
28
3% of all-time downloads
mmnga/Mixtral-Extraction-4x7B-Instruct-v0.1
Mixtral-Extraction-4x7B-Instruct-v0.1 is a text generation model from mmnga. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This model is an experimental model created by merging mistralai/Mixtral-8x7B-Instruct-v0.1 experts.
Downloads · 30 days
28
3% of all-time downloads
All-time downloads
914
Public
Parameters
24.2B
48.3 GB on disk
Likes
5
Public
Click a slice to open those files.
.safetensors48.3 GB · 100%
From the Hugging Face model README
This model is an experimental model created by merging mistralai/Mixtral-8x7B-Instruct-v0.1 experts.
Experts are selected and extracted.
This model specifies 4 experts.
use colab cpu-high-memory.
You can extract experts 1-7 by selecting experts as bit string.
experts_extract_bit = "11110000"
convert_mixtral_8x7b_to_4x7b_extract.ipynb
pip install git+https://github.com/huggingface/transformers --upgrade
pip install torch accelerate bitsandbytes flash_attn
from transformers import AutoTokenizer, AutoModelForCausalLM, MixtralForCausalLM
import torch
model_name_or_path = "mmnga/Mixtral-Extraction-4x7B-Instruct-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = MixtralForCausalLM.from_pretrained(model_name_or_path, load_in_8bit=True)
text = "[INST] What was John Holt's vision on education? [/INST] "
inputs = tokenizer("<s> " + text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))