Instructions to use unsloth/gpt-oss-120b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gpt-oss-120b-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/gpt-oss-120b-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-120b-GGUF") model = AutoModelForCausalLM.from_pretrained("unsloth/gpt-oss-120b-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/gpt-oss-120b-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-120b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gpt-oss-120b-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-120b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama cli -hf unsloth/gpt-oss-120b-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-120b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/gpt-oss-120b-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-120b-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use unsloth/gpt-oss-120b-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-120b-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-120b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
- SGLang
How to use unsloth/gpt-oss-120b-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-120b-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-120b-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-120b-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-120b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use unsloth/gpt-oss-120b-GGUF with Ollama:
ollama run hf.co/unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use unsloth/gpt-oss-120b-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-120b-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-120b-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-120b-GGUF to start chatting
- Pi
How to use unsloth/gpt-oss-120b-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-120b-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-120b-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use unsloth/gpt-oss-120b-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/gpt-oss-120b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/gpt-oss-120b-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.gpt-oss-120b-GGUF-UD-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use unsloth/gpt-oss-120b-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-120b-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-120b-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use unsloth/gpt-oss-120b-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-120b-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-120b-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"
GGUF is very slow for some reason
Hi there, thanks for great job!
I was trying to utilize 2 GPUs and swapped to this GGUFs from LM Studio MXFP4, and it's surprisingly slow.
I guess something is wrong with my setup but i can't figure it out.
I'm running llama.cpp:
llama-server --device CUDA0 --model ~/models/unsloth/gpt-oss-120b/Q8_0/gpt-oss-120b-Q8_0-00001-of-00002.gguf \
--host 0.0.0.0 \
--port 8052 \
--jinja \
--ctx-size 65536 \
--threads 1 \
--n-cpu-moe 30 \
--flash-attn \
--temp 1.0 \
--top-p 1.0 \
--min-p 0.0 \
--top-k 0 \
--n-gpu-layers 99 \
--chat-template-kwargs '{"builtin_tools":["python", "browser"], "reasoning_effort":"high"}'
Test with single GPU first.
Q8_0 GGUF gives me 6 tk/s, when MXFP4 from LM Studio gives around 25 tk/s with exaclty same run command.
I was trying with both GPUs with -ot ".ffn_(up|down)_exps.=CPU" but it's also around 7 tk/s.
llama-server version: 6257 (b1afcab8)
cmake -B build -DGGML_CUDA=ON -DGGML_CUDA_FA_ALL_QUANTS=ON -DGGML_CUDA_F16=ON -DCURL_LIBRARY=/usr/lib/x86_64-linux-gnu/libcurl.so -DGGML_CUDA_MMQ=ON
Could you help me to understand what is not working properly?
https://docs.unsloth.ai/basics/gpt-oss-how-to-run-and-fine-tune#run-gpt-oss-120b
Inside this guide there is an option --threads 1 which pretty much same as default.
But if i don't pass --threads 1 I'm getting 22-23 tokens/sec, when i pass --threads 10 I'm getting 23-24 tokens/sec, but if i pass --threads 1 I get 6 tokens/sec.
That's some black magic going on here.
Now it works, Q8_0 runs at pretty much same speed as MXFP4.
llama-server --device CUDA0,CUDA1 \
--model ~/models/unsloth/gpt-oss-120b/Q8_0/gpt-oss-120b-Q8_0-00001-of-00002.gguf \
--host 0.0.0.0 \
--port 8052 \
--jinja \
--threads 10 \
--ctx-size 65536 \
--batch-size 4096 \
--ubatch-size 2048 \
-ot ".ffn_(up|down)_exps.=CPU" \
--flash-attn \
--temp 1.0 \
--top-p 1.0 \
--top-k 0 \
--n-gpu-layers 999 \
--chat-template-kwargs '{"builtin_tools":["python", "browser"], "reasoning_effort":"high"}'
Gives around 26 tokens/sec, difference is minimal with 1 GPU, so I guess i will stick to 1 GPU and run other models on 2nd one.
hi @ineersa will the following command also work for https://huggingface.co/unsloth/gpt-oss-safeguard-20b-GGUF ?
llama-server --device CUDA0,CUDA1
--model ~/models/unsloth/gpt-oss-safeguard-20b-GGUF /gpt-oss-safeguard-20b-Q2_K_L.gguf
--host 0.0.0.0
--port 8052
--jinja
--threads 10
--ctx-size 65536
--batch-size 4096
--ubatch-size 2048
-ot ".ffn_(up|down)_exps.=CPU"
--flash-attn
--temp 1.0
--top-p 1.0
--top-k 0
--n-gpu-layers 999
--chat-template-kwargs '{"builtin_tools":["python", "browser"], "reasoning_effort":"high"}'