Instructions to use kirikir13/MOEmoe-3x7B-BF16-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kirikir13/MOEmoe-3x7B-BF16-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kirikir13/MOEmoe-3x7B-BF16-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kirikir13/MOEmoe-3x7B-BF16-v2") model = AutoModelForCausalLM.from_pretrained("kirikir13/MOEmoe-3x7B-BF16-v2", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kirikir13/MOEmoe-3x7B-BF16-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kirikir13/MOEmoe-3x7B-BF16-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kirikir13/MOEmoe-3x7B-BF16-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kirikir13/MOEmoe-3x7B-BF16-v2
- SGLang
How to use kirikir13/MOEmoe-3x7B-BF16-v2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kirikir13/MOEmoe-3x7B-BF16-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kirikir13/MOEmoe-3x7B-BF16-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kirikir13/MOEmoe-3x7B-BF16-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kirikir13/MOEmoe-3x7B-BF16-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kirikir13/MOEmoe-3x7B-BF16-v2 with Docker Model Runner:
docker model run hf.co/kirikir13/MOEmoe-3x7B-BF16-v2
MOEmoe-3x7B-BF16 (v2 rebuild)
Architecture: Built from 3 models: [M] MixtralForCausalLM (model_type: mixtral), 1 expert [MINSTRAL] Minstrel Is Lee personality and tool department followed by [O] `openchat/openchat-3.5 Whose role is the logic and reasoning, Proceeded by:[E] openbmb/Eurus-7b-kto Who is head of the math department for a total of a 19B M.O.E. Named: "MOEmoe" Which is my very first M.O.E. Or as I like to say: "Mistral of Exports ๐. Next I will then be creating a couple of this in new specialized custom quants thus reducing it down to an estimated 7GB With your loss intelligence or abilities Stay tuned
Goerge Roby & 'theCREW' [DR Studios]
The name
MOEmoe = "Mistral of Experts". Three Mistral-family 7B models whose initials spell M-O-E:
- M = Mistral-7B-Instruct-v0.2, the main talker ("Minstrel" in the original note was a spelling slip for Mistral)
- O = OpenChat-3.5, logic and reasoning
- E = Eurus-7b-kto, math
They share the same tokenizer and tensor shapes, so they frankenmerge cleanly into one Mixtral-style MoE.
Why v2 exists
The original upload kirikir13/MOEmoe-3x7B-BF16 (and its bucket copies) is incomplete: 19.3 GB of the ~37.0 GB model. It only has layers 0โ15 and part of layer 16. Layers 16โ31, all 32 router (gate) weights, model.norm and lm_head are missing (upload/hard-drive failure). The original is left untouched. This repo is a full rebuild from the same source models with mergekit-moe.
Architecture
| Class | MixtralForCausalLM (model_type: mixtral) |
| Experts | 3 (num_local_experts: 3), top-2 routing (num_experts_per_tok: 2) |
| Layers / hidden / FFN | 32 / 4096 / 14336 |
| Attention | 32 heads, 8 KV heads (GQA), head_dim 128 |
| RoPE theta / context | 1,000,000 / 32768 (from Mistral-7B-Instruct-v0.2), no sliding window |
| Vocab | 32000 (Mistral SentencePiece), bos <s>=1, eos </s>=2 |
| Params / size |
| Expert | Source model | Role |
|---|---|---|
| 0 | mistralai/Mistral-7B-Instruct-v0.2 | Main talker: personality, chat, tools (also supplies attention, embeddings, norms, lm_head) |
| 1 | openchat/openchat_3.5 | Logic and reasoning |
| 2 | openbmb/Eurus-7b-kto | Math |
The source weights came from George's bucket kirikir13/M-O-E_moe. The original config's _name_or_path was Mistral-7B-Instruct-v0.2, so that is the base. "Minstrel" in the notes above is Mistral-7B-Instruct-v0.2.
Router: gate_mode: cheap_embed. Each expert's router vector comes from the base model's token embeddings of its positive prompts (see mergekit_moe_config.yml). hidden mode needs a full forward pass of the base model, which did not fit in the 15 GB RAM build box. The router is a sensible starting point, not a trained one. Fine-tuning the gates (or a hidden rebuild on a bigger machine) will sharpen the routing.
Tokenizer and chat template
The tokenizer is Mistral-7B-Instruct-v0.2's (32000 tokens). It matches vocab_size and the embed_tokens/lm_head shape [32000, 4096] exactly. The embeddings come from the Mistral base. OpenChat's tokenizer has 32002 tokens (<|end_of_turn|>, <|pad_0|>), which this model has no embeddings for, so the OpenChat "GPT4 Correct User" template is not used. The chat template is Mistral [INST]:
<s> [INST] {system}\n\n{user} [/INST] {assistant}</s>
Usage (transformers)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
repo = "kirikir13/MOEmoe-3x7B-BF16-v2"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
msgs = [{"role": "user", "content": "Solve 3x + 5 = 20 and explain."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256)
print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))
You need about 38 GB RAM/VRAM in BF16. Use 4-bit (bitsandbytes) or a GGUF quant for smaller machines.
"Main talker only" switch
- 1 expert per token: set
"num_experts_per_tok": 1inconfig.json, orconfig.num_experts_per_tok = 1before loading. This is faster, but the router still picks per token. - Talker only: there is no exact gate-only switch, because router scores depend on the token. If you want only the talker, run expert 0's source model (Mistral-7B-Instruct-v0.2) directly. A future build can give the talker a stronger prior by adding more and broader positive prompts to expert 0.
llama.cpp / GGUF
The weights use the classic Mixtral tensor names (block_sparse_moe.experts.N.w1/w2/w3, block_sparse_moe.gate), so llama.cpp converts them directly:
python convert_hf_to_gguf.py ./MOEmoe-3x7B-BF16-v2 --outtype bf16 --outfile moemoe-3x7b-bf16.gguf
./llama-quantize moemoe-3x7b-bf16.gguf moemoe-3x7b-Q4_K_M.gguf Q4_K_M # ~11 GB
./llama-server -m moemoe-3x7b-Q4_K_M.gguf --chat-template mistral -c 8192
To run on a single expert in llama.cpp, add --override-kv llama.expert_used_count=int:1.
Files
model-0000{1..8}-of-00008.safetensorsandmodel.safetensors.index.json: 515 tensors, 37,032,828,928 bytes, BF16config.json,generation_config.json(bos 1, eos 2)tokenizer.json,tokenizer.model,tokenizer_config.json,special_tokens_map.json,chat_template.jinjamergekit_moe_config.yml: the exact merge recipe
Changelog
- Oct 23, 2026: v2 full rebuild. Diagnosed the v1 upload as truncated (missing layers 16โ31, routers, final norm, lm_head). Rebuilt with mergekit 0.1.5 (
mergekit-moe --lazy-unpickle, CPU,gate_mode: cheap_embed, top-2) from Mistral-7B-Instruct-v0.2 + openchat_3.5 + Eurus-7b-kto. Converted to classic Mixtral tensor names for llama.cpp/vLLM/transformers-4.x compatibility. Added the tokenizer,[INST]chat template, generation config and index. Verified: the index matches all shard headers; transformers 5.20.2 loads it with 0 missing / 0 unexpected / 0 mismatched keys; a 2-layer forward pass gives finite logits and a working router.
- Downloads last month
- 32
Model tree for kirikir13/MOEmoe-3x7B-BF16-v2
Base model
mistralai/Mistral-7B-Instruct-v0.2