Instructions to use unsloth/GLM-5.1-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/GLM-5.1-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/GLM-5.1-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("unsloth/GLM-5.1-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/GLM-5.1-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/GLM-5.1-GGUF:UD-Q4_K_M # Run inference directly in the terminal: llama cli -hf unsloth/GLM-5.1-GGUF:UD-Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf unsloth/GLM-5.1-GGUF:UD-Q4_K_M # Run inference directly in the terminal: llama cli -hf unsloth/GLM-5.1-GGUF:UD-Q4_K_M
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/GLM-5.1-GGUF:UD-Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf unsloth/GLM-5.1-GGUF:UD-Q4_K_M
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/GLM-5.1-GGUF:UD-Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/GLM-5.1-GGUF:UD-Q4_K_M
Use Docker
docker model run hf.co/unsloth/GLM-5.1-GGUF:UD-Q4_K_M
- LM Studio
- Jan
- vLLM
How to use unsloth/GLM-5.1-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/GLM-5.1-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/GLM-5.1-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/GLM-5.1-GGUF:UD-Q4_K_M
- SGLang
How to use unsloth/GLM-5.1-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/GLM-5.1-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/GLM-5.1-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/GLM-5.1-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/GLM-5.1-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use unsloth/GLM-5.1-GGUF with Ollama:
ollama run hf.co/unsloth/GLM-5.1-GGUF:UD-Q4_K_M
- Unsloth Desktop
- Pi
How to use unsloth/GLM-5.1-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/GLM-5.1-GGUF:UD-Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/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/GLM-5.1-GGUF:UD-Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use unsloth/GLM-5.1-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/GLM-5.1-GGUF:UD-Q4_K_M
- Lemonade
How to use unsloth/GLM-5.1-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/GLM-5.1-GGUF:UD-Q4_K_M
Run and chat with the model
lemonade run user.GLM-5.1-GGUF-UD-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use unsloth/GLM-5.1-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/GLM-5.1-GGUF:UD-Q4_K_M
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/GLM-5.1-GGUF:UD-Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use unsloth/GLM-5.1-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/GLM-5.1-GGUF:UD-Q4_K_M
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/GLM-5.1-GGUF:UD-Q4_K_M" \ --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"
[Solved in b8808] IQ4_NL Gibberish in llama.cpp
Hey,
This with the command:
CUDA_VISIBLE_DEVICES=0,1,2,3,4 llama-server -m ~/.cache/huggingface/hub/models--unsloth--GLM-5.1-GGUF/snapshots/3238253553497e969f3144fda297dac98b99dbbe/UD-IQ4_NL/GLM-5.1-UD-IQ4_NL-00001-of-00009.gguf --temp 1.0 --top-p 0.95 --host 0.0.0.0 --alias "GLM 5.1"
In Ik_llama with:
CUDA_VISIBLE_DEVICES=0,1,2,3,4 ik-cli -m ~/.cache/huggingface/hub/models--unsloth--GLM-5.1-GGUF/snapshots/3238253553497e969f3144fda297dac98b99dbbe/UD-IQ4_NL/GLM-5.1-UD-IQ4_NL-00001-of-00009.gguf --temp 1.0 --top-p 0.95 --merge-qkv -ctk q8_0 -ctv q4_0 -mla 3 --no-mmap --jinja -b 8192 -ub 8192 -amb 512 -mqkv -ngl 99 --host 0.0.0.0 -khad -vhad --alias "GLM 5.1" -cnv
very coherant.
version: 8709 (85d482e6b)
built with GNU 15.2.1 for Linux x86_64
The Q4_K_XL quantization keeps outputting question marks on my machine.
IQ_4XS broken for me in mainline llama.cpp
version: 8709 (85d482e6b)
built with GNU 15.2.1 for Linux x86_64
The Q4_K_XL quantization keeps outputting question marks on my machine.
IQ_4XS broken for me in mainline llama.cpp
What CUDA version are you guys using?
What CUDA version are you guys using?
13.2
What CUDA version are you guys using?
13.2
That's why, at the moment CUDA 13.2 doesn't work for any GGUF and it spits out gibberish no matter the uploader. It's a known issue and we told NVIDIA to fix it but it looks like they are not done yet.
in the meantime it works on ik_llama. for thinking we need to enable it --chat-template-kwargs '{"enable_thinking":true}'
What CUDA version are you guys using?
13.2
That's why, at the moment CUDA 13.2 doesn't work for any GGUF and it spits out GGUF no matter the uploader. It's a known issue and we told NVIDIA to fix it but it looks like they are not done yet....
This is actually a rather strange bug. Some requests do work fine, actually, and some doesn't.
here is some samples:
Bad one (request in Russian, about 5000 tokens) - gibberish:
Short request in Russian - perfectly fine coherent answer:
Short request in English - also works fine.
Long summarization request (about 8000 tokens) - gibberish:
Here is some startup logs:
srv load: spawning server instance with name=GLM-5-1-IQ4-XS:default on port 37067
srv load: spawning server instance with args:
srv load: /home/drros/llama.cpp/build/bin/llama-server
srv load: --host
srv load: 127.0.0.1
srv load: --mlock
srv load: --no-mmap
srv load: --no-mmproj-offload
srv load: --port
srv load: 37067
srv load: --temperature
srv load: 1.0
srv load: --top-p
srv load: 0.95
srv load: --webui-mcp-proxy
srv load: --alias
srv load: GLM-5-1-IQ4-XS:default
srv load: --ctx-size
srv load: 102400
srv load: --cache-type-k
srv load: q8_0
srv load: --cache-type-v
srv load: q8_0
srv load: --fit-target
srv load: 1024,1024,1024
srv load: --kv-unified
srv load: --model
srv load: /mnt/ds1nfs/codellamaweights/glm-5-1-iq4-xxs/GLM-5.1-UD-IQ4_XS-00001-of-00009.gguf
srv load: --parallel
srv load: 4
srv load: --reasoning
srv load: on
srv load: --ubatch-size
srv load: 2048
srv log_server_r: done request: POST /models/load 192.168.0.61 200
[37067] ggml_cuda_init: found 3 CUDA devices (Total VRAM: 71963 MiB):
[37067] Device 0: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB
[37067] Device 1: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB
[37067] Device 2: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB
[37067] build_info: b8720-d12cc3d1c
in the meantime it works on
ik_llama. for thinking we need to enable it--chat-template-kwargs '{"enable_thinking":true}'
What CUDA version are you guys using?
13.2
That's why, at the moment CUDA 13.2 doesn't work for any GGUF and it spits out GGUF no matter the uploader. It's a known issue and we told NVIDIA to fix it but it looks like they are not done yet....
This is actually a rather strange bug. Some requests do work fine, actually, and some doesn't.
here is some samples:
Bad one (request in Russian, about 5000 tokens) - gibberish:Short request in Russian - perfectly fine coherent answer:
Short request in English - also works fine.
Long summarization request (about 8000 tokens) - gibberish:
Here is some startup logs:
srv load: spawning server instance with name=GLM-5-1-IQ4-XS:default on port 37067 srv load: spawning server instance with args: srv load: /home/drros/llama.cpp/build/bin/llama-server srv load: --host srv load: 127.0.0.1 srv load: --mlock srv load: --no-mmap srv load: --no-mmproj-offload srv load: --port srv load: 37067 srv load: --temperature srv load: 1.0 srv load: --top-p srv load: 0.95 srv load: --webui-mcp-proxy srv load: --alias srv load: GLM-5-1-IQ4-XS:default srv load: --ctx-size srv load: 102400 srv load: --cache-type-k srv load: q8_0 srv load: --cache-type-v srv load: q8_0 srv load: --fit-target srv load: 1024,1024,1024 srv load: --kv-unified srv load: --model srv load: /mnt/ds1nfs/codellamaweights/glm-5-1-iq4-xxs/GLM-5.1-UD-IQ4_XS-00001-of-00009.gguf srv load: --parallel srv load: 4 srv load: --reasoning srv load: on srv load: --ubatch-size srv load: 2048 srv log_server_r: done request: POST /models/load 192.168.0.61 200 [37067] ggml_cuda_init: found 3 CUDA devices (Total VRAM: 71963 MiB): [37067] Device 0: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB [37067] Device 1: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB [37067] Device 2: NVIDIA RTX PRO 4000 Blackwell, compute capability 12.0, VMM: yes, VRAM: 23987 MiB [37067] build_info: b8720-d12cc3d1c
Using any version lower than CUDA 13.2 will solve your issue. Unsloth Studio for example uses 13.0 so there is no issue with generation
I think we should make a PSA and let everyone know not to use CUDA 13.2 because it seems like it's more problematic than originally anticipated
How come ik_llama works but llama.cpp doesn't? If the problem lies in CUDA 13.2...
How come
ik_llamaworks butllama.cppdoesn't? If the problem lies in CUDA 13.2...
If ik_llama works then continue using that, but still would not recommend using CUDA 13.2. The issue has been confirmed by us and 30+ users.
I have a similar problem. llama.cpp-b8733.tar.gz works well; following versions (didn't pinpoint the exact breaking change version yet) give gibberish output most of the times.
This might give some insight on why ik_llama works thogh?
I see this problem with CUDA 13.0 (Toolkit version 13.0.2, nvcc V13.0.88) Driver Version: 595.58.03
b8808 seems to work fine now! I believe there was a problem with FA in some previous release that got fixed.
b8808 seems to work fine now! I believe there was a problem with FA in some previous release that got fixed.
Awesome thanks for sharing! @jpsequeira could you edit your post if possible incase other people also encoutner the problem? Thanks so much! :)




