Views
No views yet
gpt-oss-120b — for production, general purpose, high reasoning use cases that fit into a single 80GB GPU (like NVIDIA H100 or AMD MI300X) (117B parameters with 5.1B active parameters)gpt-oss-20b — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters)[!NOTE] This model card is dedicated to the smallergpt-oss-20bmodel. Check outgpt-oss-120bfor the larger model.
gpt-oss-120b run on a single 80GB GPU (like NVIDIA H100 or AMD MI300X) and the gpt-oss-20b model run within 16GB of memory. All evals were performed with the same MXFP4 quantization.gpt-oss-120b and gpt-oss-20b with Transformers. If you use the Transformers chat template, it will automatically apply the harmony response format. If you use model.generate directly, you need to apply the harmony format manually using the chat template or use our openai-harmony package.pip install -U transformers kernels torch 1from transformers import pipeline
2import torch
3model_id = "openai/gpt-oss-20b"
4pipe = pipeline(
5 "text-generation",
6 model=model_id,
7 torch_dtype="auto",
8 device_map="auto",
9)
10messages = [
11 {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
12]
13outputs = pipe(
14 messages,
15 max_new_tokens=256,
16)
17print(outputs[0]["generated_text"][-1])Transformers Serve to spin up a OpenAI-compatible webserver:transformers serve
transformers chat localhost:8000 --model-name-or-path openai/gpt-oss-20b%%capture
# We're installing the latest Torch, Triton, OpenAI's Triton kernels, Transformers and Unsloth!
!pip install --upgrade -qqq uv
try: import numpy; install_numpy = f"numpy=={numpy.__version__}"
except: install_numpy = "numpy"
!uv pip install -qqq \
"torch>=2.8.0" "triton>=3.4.0" {install_numpy} \
"unsloth_zoo[base] @ git+https://github.com/unslothai/unsloth-zoo" \
"unsloth[base] @ git+https://github.com/unslothai/unsloth" \
torchvision bitsandbytes \
git+https://github.com/huggingface/transformers \
git+https://github.com/triton-lang/triton.git@05b2c186c1b6c9a08375389d5efe9cb4c401c075#subdirectory=python/triton_kernelsfrom unsloth import FastLanguageModel
import torch
max_seq_length = 1024
dtype = None
# 4bit pre quantized models we support for 4x faster downloading + no OOMs.
fourbit_models = [
"unsloth/gpt-oss-20b-unsloth-bnb-4bit", # 20B model using bitsandbytes 4bit quantization
"unsloth/gpt-oss-120b-unsloth-bnb-4bit",
"unsloth/gpt-oss-20b", # 20B model using MXFP4 format
"unsloth/gpt-oss-120b",
] # More models at https://huggingface.co/unsloth
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "EpistemeAI/gpt-oss-20b-unsloth-finetune-lora",
dtype = dtype, # None for auto detection
max_seq_length = max_seq_length, # Choose any for long context!
load_in_4bit = True, # 4 bit quantization to reduce memory
full_finetuning = False, # [NEW!] We have full finetuning now!
# token = "hf_...", # use one if using gated models
)model = FastLanguageModel.get_peft_model(
model,
r = 8, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",],
lora_alpha = 16,
lora_dropout = 0, # Supports any, but = 0 is optimized
bias = "none", # Supports any, but = "none" is optimized
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
random_state = 3407,
use_rslora = False, # We support rank stabilized LoRA
loftq_config = None, # And LoftQ
)messages = [
{"role": "system", "content": "You are a helpful assistant that can solve puzzle problems."},
{"role": "user", "content": "Solve x^5 + 3x^4 - 10 = 3."},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt = True,
return_tensors = "pt",
return_dict = True,
reasoning_effort = "high", # **NEW!** Set reasoning effort to low, medium or high
).to(model.device)
_ = model.generate(**inputs, max_new_tokens = 64, streamer = TextStreamer(tokenizer))1uv pip install --pre vllm==0.10.1+gptoss \
2 --extra-index-url https://wheels.vllm.ai/gpt-oss/ \
3 --extra-index-url https://download.pytorch.org/whl/nightly/cu128 \
4 --index-strategy unsafe-best-match
5vllm serve openai/gpt-oss-20b1# gpt-oss-20b
2ollama pull gpt-oss:20b
3ollama run gpt-oss:20b1# gpt-oss-20b
2lms get openai/gpt-oss-20b1# gpt-oss-20b
2huggingface-cli download openai/gpt-oss-20b --include "original/*" --local-dir gpt-oss-20b/
3pip install gpt-oss
4python -m gpt_oss.chat model/gpt-oss-20b can be fine-tuned on consumer hardware, whereas the larger gpt-oss-120b can be fine-tuned on a single H100 node.