Instructions to use unsloth/gpt-oss-20b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gpt-oss-20b-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/gpt-oss-20b-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/gpt-oss-20b-GGUF") model = AutoModelForCausalLM.from_pretrained("unsloth/gpt-oss-20b-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/gpt-oss-20b-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use unsloth/gpt-oss-20b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gpt-oss-20b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/gpt-oss-20b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
- SGLang
How to use unsloth/gpt-oss-20b-GGUF 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 "unsloth/gpt-oss-20b-GGUF" \ --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": "unsloth/gpt-oss-20b-GGUF", "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 "unsloth/gpt-oss-20b-GGUF" \ --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": "unsloth/gpt-oss-20b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use unsloth/gpt-oss-20b-GGUF with Ollama:
ollama run hf.co/unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use unsloth/gpt-oss-20b-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gpt-oss-20b-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gpt-oss-20b-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/gpt-oss-20b-GGUF to start chatting
- Pi
How to use unsloth/gpt-oss-20b-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use unsloth/gpt-oss-20b-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use unsloth/gpt-oss-20b-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/gpt-oss-20b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.gpt-oss-20b-GGUF-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use unsloth/gpt-oss-20b-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
Add files using upload-large-folder tool
Browse files- .gitattributes +4 -0
- MXFP4.gguf +3 -0
- README.md +2 -32
- config.json +77 -0
- gpt-oss-20b-BF16.gguf +3 -0
- gpt-oss-20b-MXFP4.gguf +3 -0
- gpt-oss-20b-Q2_only.gguf +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
gpt-oss-20b-Q2_only.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
gpt-oss-20b-MXFP4.gguf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
gpt-oss-20b-BF16.gguf filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
MXFP4.gguf filter=lfs diff=lfs merge=lfs -text
|
MXFP4.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:98d8c447518f21d3adf58f4fb2024da713588e8efcbd7dc88c36cff56ad88512
|
| 3 |
+
size 13792637856
|
README.md
CHANGED
|
@@ -5,40 +5,10 @@ license: apache-2.0
|
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
library_name: transformers
|
| 7 |
tags:
|
| 8 |
-
-
|
| 9 |
- unsloth
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
> We're working on them, should be up in a few hours!
|
| 13 |
-
>
|
| 14 |
-
<div>
|
| 15 |
-
<p style="margin-bottom: 0; margin-top: 0;">
|
| 16 |
-
<strong>See <a href="https://huggingface.co/collections/unsloth/gpt-oss-6892433695ce0dee42f31681">our collection</a> for all versions of gpt-oss including GGUF, 4-bit & 16-bit formats.</strong>
|
| 17 |
-
</p>
|
| 18 |
-
<p style="margin-bottom: 0;">
|
| 19 |
-
<em>Learn to run gpt-oss correctly - <a href="https://docs.unsloth.ai/basics/gpt-oss">Read our Guide</a>.</em>
|
| 20 |
-
</p>
|
| 21 |
-
<p style="margin-top: 0;margin-bottom: 0;">
|
| 22 |
-
<em>See <a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0 GGUFs</a> for our quantization benchmarks.</em>
|
| 23 |
-
</p>
|
| 24 |
-
<div style="display: flex; gap: 5px; align-items: center; ">
|
| 25 |
-
<a href="https://github.com/unslothai/unsloth/">
|
| 26 |
-
<img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
|
| 27 |
-
</a>
|
| 28 |
-
<a href="https://discord.gg/unsloth">
|
| 29 |
-
<img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
|
| 30 |
-
</a>
|
| 31 |
-
<a href="https://docs.unsloth.ai/basics/qwen3-coder">
|
| 32 |
-
<img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
|
| 33 |
-
</a>
|
| 34 |
-
</div>
|
| 35 |
-
<h1 style="margin-top: 0rem;">✨ Read our gpt-oss Guide <a href="https://docs.unsloth.ai/basics/gpt-oss">here</a>!</h1>
|
| 36 |
-
</div>
|
| 37 |
-
|
| 38 |
-
- Read our Blog about gpt-oss support: [unsloth.ai/blog/gpt-oss](https://unsloth.ai/blog/gpt-oss)
|
| 39 |
-
- View the rest of our notebooks in our [docs here](https://docs.unsloth.ai/get-started/unsloth-notebooks).
|
| 40 |
-
|
| 41 |
-
# gpt-oss-20b Details
|
| 42 |
<p align="center">
|
| 43 |
<img alt="gpt-oss-20b" src="https://raw.githubusercontent.com/openai/gpt-oss/main/docs/gpt-oss-20b.svg">
|
| 44 |
</p>
|
|
|
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
library_name: transformers
|
| 7 |
tags:
|
| 8 |
+
- vllm
|
| 9 |
- unsloth
|
| 10 |
---
|
| 11 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
<p align="center">
|
| 13 |
<img alt="gpt-oss-20b" src="https://raw.githubusercontent.com/openai/gpt-oss/main/docs/gpt-oss-20b.svg">
|
| 14 |
</p>
|
config.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"GptOssForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": true,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"eos_token_id": 200002,
|
| 8 |
+
"experts_per_token": 4,
|
| 9 |
+
"head_dim": 64,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 2880,
|
| 12 |
+
"initial_context_length": 4096,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 2880,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"sliding_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"sliding_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"sliding_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"sliding_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"sliding_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"sliding_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"sliding_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"sliding_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"full_attention"
|
| 40 |
+
],
|
| 41 |
+
"max_position_embeddings": 131072,
|
| 42 |
+
"model_type": "gpt_oss",
|
| 43 |
+
"num_attention_heads": 64,
|
| 44 |
+
"num_experts_per_tok": 4,
|
| 45 |
+
"num_hidden_layers": 24,
|
| 46 |
+
"num_key_value_heads": 8,
|
| 47 |
+
"num_local_experts": 32,
|
| 48 |
+
"output_router_logits": false,
|
| 49 |
+
"pad_token_id": 200017,
|
| 50 |
+
"quantization_config": {
|
| 51 |
+
"modules_to_not_convert": [
|
| 52 |
+
"model.layers.*.self_attn",
|
| 53 |
+
"model.layers.*.mlp.router",
|
| 54 |
+
"model.embed_tokens",
|
| 55 |
+
"lm_head"
|
| 56 |
+
],
|
| 57 |
+
"quant_method": "mxfp4"
|
| 58 |
+
},
|
| 59 |
+
"rms_norm_eps": 1e-05,
|
| 60 |
+
"rope_scaling": {
|
| 61 |
+
"beta_fast": 32.0,
|
| 62 |
+
"beta_slow": 1.0,
|
| 63 |
+
"factor": 32.0,
|
| 64 |
+
"original_max_position_embeddings": 4096,
|
| 65 |
+
"rope_type": "yarn",
|
| 66 |
+
"truncate": false
|
| 67 |
+
},
|
| 68 |
+
"rope_theta": 150000,
|
| 69 |
+
"router_aux_loss_coef": 0.9,
|
| 70 |
+
"sliding_window": 128,
|
| 71 |
+
"swiglu_limit": 7.0,
|
| 72 |
+
"tie_word_embeddings": false,
|
| 73 |
+
"transformers_version": "4.56.0.dev0",
|
| 74 |
+
"unsloth_fixed": true,
|
| 75 |
+
"use_cache": true,
|
| 76 |
+
"vocab_size": 201088
|
| 77 |
+
}
|
gpt-oss-20b-BF16.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8d44f6e3399adad54fe8be818b41c720d8df37f47331048a06caaf78c5350234
|
| 3 |
+
size 13792638144
|
gpt-oss-20b-MXFP4.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b93a63c42fc2432396b56031bb1a4aa5f598af1de369de397a900888032cad64
|
| 3 |
+
size 13792636800
|
gpt-oss-20b-Q2_only.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c20f7c6c3b9c4b61134b8914996833f8c05887683336b49e1b90df8169048b2
|
| 3 |
+
size 13007308
|