Text Generation
Transformers
Safetensors
gpt_oss
vllm
conversational
Eval Results
8-bit precision
mxfp4
Instructions to use openai/gpt-oss-20b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai/gpt-oss-20b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openai/gpt-oss-20b") 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("openai/gpt-oss-20b") model = AutoModelForCausalLM.from_pretrained("openai/gpt-oss-20b", 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]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
- Local Apps Settings
- vLLM
How to use openai/gpt-oss-20b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openai/gpt-oss-20b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openai/gpt-oss-20b
- SGLang
How to use openai/gpt-oss-20b 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 "openai/gpt-oss-20b" \ --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": "openai/gpt-oss-20b", "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 "openai/gpt-oss-20b" \ --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": "openai/gpt-oss-20b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openai/gpt-oss-20b with Docker Model Runner:
docker model run hf.co/openai/gpt-oss-20b
Commit History
-
Update EvalEval source links to flat datastore
Verified signatureUpdates existing EvalEval Community Evals YAML entries to link to flat datastore aggregate objects pinned to an immutable EEE datastore commit, and normalizes source.name to EvalEval. No score, dataset, task, or date changes are intended. This updates existing open PR refs only. Contributor: evaleval9a2ba70
-
Add EvalEval community eval results
Verified signatureAdds EvalEval Community Evals YAML entries with source backlinks to EEE aggregate records. Contributor: evaleval2dc26fa
-
Add EvalEval community eval results
Verified signatureAdds EvalEval Community Evals YAML entries with source backlinks to EEE aggregate records. Contributor: evaleval31c4b34 -
Add EvalEval community eval results
Verified signatureAdds EvalEval Community Evals YAML entries with source backlinks to EEE aggregate records. Contributor: evaleval7b9a0cf
-
Update README.md
Verified signature6cee5e8
-
Configure `<|call|>` as an EOS token (#109)
Verified signature- Configure `<|call|>` as an EOS token (a44a7f14988426860a0a8145cf2bdfda2d7cadac) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>d666cf3 -
Update README.md
Verified signatureClarify MXFP4 quantization calloutf4770b2
-
Update chat_template.jinja (#94)
Verified signature- Update chat_template.jinja (6965815ae896176f6b820fd508d15ebbca89a903) Co-authored-by: Quentin Gallouédec <qgallouedec@users.noreply.huggingface.co>cbf31f6 -
Update README.md
Verified signaturedb6852c
-
Updated chat template (#82)
Verified signature- Updated chat template (03fd454aae9be5799e9531726db7f6d0673675cb) Co-authored-by: Matthew Carrigan <Rocketknight1@users.noreply.huggingface.co>10e9d71
-
Update the model name in USAGE_POLICY (#52)
Verified signature- Update USAGE_POLICY (ccef4ca7b48a5797b0b436e77f5cd0c643449942) Co-authored-by: B. <Enes@users.noreply.huggingface.co>2e8f805 -
Remove chat_template.json (#59)
Verified signature- Delete chat_template.json (2196d2723661213010470df3f39b50bc098b0bb5) Co-authored-by: Matthew Carrigan <Rocketknight1@users.noreply.huggingface.co>ef533c9
-
Update README
Verified signaturebbf0930 -
Update LICENSE
Verified signaturef47b956 -
Update vLLM command
Verified signature6cd4d0f -
Add model card
Verified signature21ae1e7 -
Upload folder using huggingface_hub
Verified signatureec854da -
Upload folder using huggingface_hub
Verified signature5a5e34e
-
Upload folder using huggingface_hub
Verified signaturef81fef1 -
initial commit
Verified signature2923e0b