gpt-oss for Tenstorrent Tensix
Collection
1 item • Updated
These weights from openai/gpt-oss-20b are quantized for Tenstorrent Tensix NPUs (Wormhole, Blackhole), with each format in its own folder.
| Folder | Formats | Size (GB, packed) | Mean KL to BF16 |
|---|---|---|---|
bfp4/ |
Routed experts bfloat4_b; attention and LM head bfloat8_b; the rest bf16 | 13.218 | 0.0636 |
bfp8/ |
Attention and routed experts and LM head bfloat8_b; the rest bf16 | 22.773 | 0.0488 |
| BF16 (openai/gpt-oss-20b) | - | 41.83 | 0 |
| MXFP4 (llama.cpp) | - | 12.110 | 0.0678 |
KL covers 8,188 positions of English and Korean text (WikiText-2 test, Korean Wikipedia), as plain text.
hf download Xylolabs/gpt-oss-20b-Tenstorrent-Tensix --include "bfp4/*" --local-dir gpt-oss-20b-Tenstorrent-Tensix
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("gpt-oss-20b-Tenstorrent-Tensix/bfp4")
model = AutoModelForCausalLM.from_pretrained("gpt-oss-20b-Tenstorrent-Tensix/bfp4", dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "What is the capital of France?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt",
return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=64)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Pack one matrix:
import json
import torch
import ttnn
from safetensors import safe_open
d = "gpt-oss-20b-Tenstorrent-Tensix/bfp4"
name = "model.layers.0.self_attn.o_proj.weight"
fmt = json.load(open(f"{d}/quant4.json"))["layers"]["0"]["self_attn.o_proj"]["format"]
dtype = {"bfp4": ttnn.bfloat4_b, "bfp8": ttnn.bfloat8_b}[fmt]
shard = json.load(open(f"{d}/model.safetensors.index.json"))["weight_map"][name]
with safe_open(f"{d}/{shard}", "pt") as f:
w = f.get_tensor(name).t().contiguous()
device = ttnn.open_device(device_id=0)
w_tt = ttnn.as_tensor(w, dtype=dtype, layout=ttnn.TILE_LAYOUT,
device=device, memory_config=ttnn.DRAM_MEMORY_CONFIG)
assert torch.equal(ttnn.to_torch(w_tt).float(), w.float())
ttnn.close_device(device)
python gpt-oss-20b-Tenstorrent-Tensix/bfp4/pack_tensix.py gpt-oss-20b-Tenstorrent-Tensix/bfp4
python gpt-oss-20b-Tenstorrent-Tensix/bfp4/verify_grid.py gpt-oss-20b-Tenstorrent-Tensix/bfp4
Add --device to round-trip the packed values.
To use another format, download its folder the same way and substitute its local path.
Apache 2.0, as the base model (LICENSE), with its usage policy (USAGE_POLICY). The changes are listed in
NOTICE. pack_tensix.py and verify_grid.py are by Xylolabs under the same license.
Each folder carries its own LICENSE and NOTICE.
@misc{openai2025gptoss120bgptoss20bmodel,
title={gpt-oss-120b & gpt-oss-20b Model Card},
author={OpenAI},
year={2025},
eprint={2508.10925},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2508.10925},
}
Base model
openai/gpt-oss-20b