Views
No views yet
gpt_oss (Mixture of Experts — 21B total, 3.6B active)Note: This conversion required a custom patch to mlx-lm'sgpt_ossmodel definition to handle the bf16 weight format used by the Swallow fine-tuned variant (the original OpenAI model uses MXFP4). The patch adds transpose and interleaved split handling forgate_up_proj/down_projexpert weights. See the Conversion Notes section below.
| Variant | Bits/weight | Disk size | Repo |
|---|---|---|---|
| 6-bit | 6.503 | ~17 GB | this repo |
| 8-bit | 8.503 | ~22 GB | tocchitocchi/GPT-OSS-Swallow-20B-RL-v0.1-8bit-mlx |
| fp16 | 16 | ~40 GB | tocchitocchi/GPT-OSS-Swallow-20B-RL-v0.1-fp16-mlx |
1pip install mlx-lm
2
3mlx_lm.generate \
4 --model tocchitocchi/GPT-OSS-Swallow-20B-RL-v0.1-6bit-mlx \
5 --prompt "日本の首都はどこですか?" \
6 --max-tokens 200 \
7 --trust-remote-code
8
9mlx_lm.chat \
10 --model tocchitocchi/GPT-OSS-Swallow-20B-RL-v0.1-6bit-mlx \
11 --trust-remote-code1from mlx_lm import load, generate
2
3model, tokenizer = load("tocchitocchi/GPT-OSS-Swallow-20B-RL-v0.1-6bit-mlx")
4
5prompt = "Pythonでフィボナッチ数列を出力するコードを書いてください"
6
7if tokenizer.chat_template is not None:
8 messages = [{"role": "user", "content": prompt}]
9 prompt = tokenizer.apply_chat_template(
10 messages, add_generation_prompt=True
11 )
12
13response = generate(model, tokenizer, prompt=prompt, verbose=True, max_tokens=500)gate_up_proj_blocks / gate_up_proj_scales). The Swallow variant was re-trained in bf16, producing standard gate_up_proj tensors with a different layout:[experts, out_features*2, ...] — split via interleave on second-to-last dim[experts, in_features, out_features*2] — split via interleave on last dim, then transposegpt_oss sanitize function was patched to detect bf16 weights (absence of _blocks/_scales keys) and apply the correct split + transpose. This patch is required for any GPT-OSS fine-tune that stores weights in bf16 HuggingFace format.1@misc{openai2025gptoss,
2 title={gpt-oss-120b & gpt-oss-20b Model Card},
3 author={OpenAI},
4 year={2025},
5 eprint={2508.10925},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}