This is a preliminary HuggingFace implementation of the newly released MoE model by MistralAi. Make sure to load with trust_remote_code=True.
Thanks to @dzhulgakov for his early implementation (https://github.com/dzhulgakov/llama-mistral) that helped me find a working setup.
Also many thanks to our friends at LAION and HessianAI for the compute used for these projects!
Benchmark scores:
hella swag: 0.8661
winogrande: 0.824
truthfulqa_mc2: 0.4855
arc_challenge: 0.6638
gsm8k: 0.5709
MMLU: 0.7173
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("DiscoResearch/mixtral-7b-8expert", low_cpu_mem_usage=True, device_map="auto", trust_remote_code=True)
tok = AutoTokenizer.from_pretrained("DiscoResearch/mixtral-7b-8expert")
x = tok.encode("The mistral wind in is a phenomenon ", return_tensors="pt").cuda()
x = model.generate(x, max_new_tokens=128).cpu()
print(tok.batch_decode(x))
Use convert_mistral_moe_weights_to_hf.py --input_dir ./input_dir --model_size 7B --output_dir ./output to convert the original consolidated weights to this HF setup.
Come chat about this in our Disco(rd)! :)
pytorch_model-00008-of-00019.bin 4.6 GiBpytorch_model-00015-of-00019.bin 4.6 GiBpytorch_model-00018-of-00019.bin 4.6 GiBpytorch_model-00011-of-00019.bin 4.6 GiBpytorch_model-00012-of-00019.bin 4.6 GiBpytorch_model-00003-of-00019.bin 4.6 GiBpytorch_model-00009-of-00019.bin 4.6 GiBpytorch_model-00013-of-00019.bin 4.6 GiBpytorch_model-00016-of-00019.bin 4.6 GiBpytorch_model-00005-of-00019.bin 4.6 GiBpytorch_model-00002-of-00019.bin 4.6 GiBpytorch_model-00006-of-00019.bin 4.6 GiBpytorch_model-00007-of-00019.bin 4.6 GiBpytorch_model-00010-of-00019.bin 4.6 GiBpytorch_model-00014-of-00019.bin 4.6 GiBpytorch_model-00017-of-00019.bin 4.6 GiBpytorch_model-00004-of-00019.bin 4.6 GiBpytorch_model-00001-of-00019.bin 4.6 GiBpytorch_model-00019-of-00019.bin 3.9 GiB