Instructions to use ubergarm/GLM-5-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use ubergarm/GLM-5-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="ubergarm/GLM-5-GGUF", filename="IQ2_KL/GLM-5-IQ2_KL-00001-of-00007.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ubergarm/GLM-5-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 ubergarm/GLM-5-GGUF:Q2_K # Run inference directly in the terminal: llama cli -hf ubergarm/GLM-5-GGUF:Q2_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ubergarm/GLM-5-GGUF:Q2_K # Run inference directly in the terminal: llama cli -hf ubergarm/GLM-5-GGUF:Q2_K
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 ubergarm/GLM-5-GGUF:Q2_K # Run inference directly in the terminal: ./llama-cli -hf ubergarm/GLM-5-GGUF:Q2_K
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 ubergarm/GLM-5-GGUF:Q2_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf ubergarm/GLM-5-GGUF:Q2_K
Use Docker
docker model run hf.co/ubergarm/GLM-5-GGUF:Q2_K
- LM Studio
- Jan
- vLLM
How to use ubergarm/GLM-5-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ubergarm/GLM-5-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": "ubergarm/GLM-5-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ubergarm/GLM-5-GGUF:Q2_K
- Ollama
How to use ubergarm/GLM-5-GGUF with Ollama:
ollama run hf.co/ubergarm/GLM-5-GGUF:Q2_K
- Unsloth Studio
How to use ubergarm/GLM-5-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 ubergarm/GLM-5-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 ubergarm/GLM-5-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ubergarm/GLM-5-GGUF to start chatting
- Pi
How to use ubergarm/GLM-5-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ubergarm/GLM-5-GGUF:Q2_K
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": "ubergarm/GLM-5-GGUF:Q2_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ubergarm/GLM-5-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 ubergarm/GLM-5-GGUF:Q2_K
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 ubergarm/GLM-5-GGUF:Q2_K
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use ubergarm/GLM-5-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ubergarm/GLM-5-GGUF:Q2_K
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 "ubergarm/GLM-5-GGUF:Q2_K" \ --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 ubergarm/GLM-5-GGUF with Docker Model Runner:
docker model run hf.co/ubergarm/GLM-5-GGUF:Q2_K
- Lemonade
How to use ubergarm/GLM-5-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ubergarm/GLM-5-GGUF:Q2_K
Run and chat with the model
lemonade run user.GLM-5-GGUF-Q2_K
List all available models
lemonade list
Unreleased
Hey,
Could you explain why you have in your perplexity chart quants with the unreleased label?
IQ4_NL seems to be the best you have there but it's unreleased, any way to get a hold of that quant?
Thanks
Could you explain why you have in your perplexity chart quants with the unreleased label?
I made some test quants and used them for benchmarking relative performance. Even if not released, it gives some relative quality comparisons.
IQ4_NL seems to be the best you have there but it's unreleased, any way to get a hold of that quant?
I didn't upload the larger models to save space on my public repo quota. and in general I focus on releasing ik_llama.cpp exclusive quants.
Check out: https://huggingface.co/AesSedai/GLM-5-GGUF as AesSedai uses similar style recipes as me focusing on mainline MoEs.
Can you remember if you used the imatrix for your IQ4_NL version?
Just testing a custom version of Q4_K that should work better with the QAT they used and got:
Final estimate: PPL over 565 chunks for n_ctx=512 = 2.6677 +/- 0.01420
(no imatrix used)
GLM-5.1 just landed!!
Looking at my logs, yes I used the imatrix in this repo with my IQ4_NL.
Here is my perplexity logs for that run:
$ grep -E '(Final|model size)' perplexity-GLM-5-smol-IQ4_NL.log
llm_load_print_meta: model size = 405.502 GiB (4.621 BPW)
Final estimate: PPL over 565 chunks for n_ctx=512 = 2.6730 +/- 0.01422
Here is the exact recipe I used for that one:
π Details
#!/usr/bin/env bash
custom="
# 79 Repeating Layers [0-78]
## Attention [0-78]
blk\..*\.attn_k_b\.weight=q8_0
blk\..*\.attn_v_b\.weight=q8_0
blk\..*\.attn_kv_a_mqa\.weight=q8_0
blk\..*\.attn_q_a\.weight=q8_0
blk\..*\.attn_q_b\.weight=q8_0
blk\..*\.attn_output\.weight=q8_0
# First 3 Dense Layers [0-2]
blk\..*\.ffn_down\.weight=iq6_k
blk\..*\.ffn_(gate|up)\.weight=iq6_k
# Shared Expert Layers [3-78]
blk\..*\.ffn_down_shexp\.weight=iq6_k
blk\..*\.ffn_(gate|up)_shexp\.weight=iq6_k
# Routed Experts Layers [3-78]
# NOTE: blk.78.* NOT implemented at time of quantizing so no imatrix data available
blk\.(78)\.ffn_down_exps\.weight=iq6_k
blk\.(78)\.ffn_(gate|up)_exps\.weight=iq6_k
blk\..*\.ffn_down_exps\.weight=iq4_nl
blk\..*\.ffn_(gate|up)_exps\.weight=iq4_nl
# Lightning indexer tensors [0-78]
# NOTE: indexer.* NOT implemented at time of quantizing so no imatrix data available
blk\..*\.indexer\.proj\.weight=q8_0
blk\..*\.indexer\.attn_k\.weight=q8_0
blk\..*\.indexer\.attn_q_b\.weight=q8_0
# NextN MTP Layer [78]
# NOTE: nextn.* NOT implemented at time of quantizing so no imatrix data available
blk\..*\.nextn\.eh_proj\.weight=q8_0
# Non-Repeating Layers
token_embd\.weight=iq6_k
output\.weight=iq6_k
"
custom=$(
echo "$custom" | grep -v '^#' | \
sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
)
numactl -N ${SOCKET} -m ${SOCKET} \
./build/bin/llama-quantize \
--custom-q "$custom" \
--imatrix /mnt/data/models/ubergarm/GLM-5-GGUF/imatrix-GLM-5-BF16.dat \
/mnt/data/models/ubergarm/GLM-5-GGUF/GLM-256x22B-5-BF16-00001-of-00033.gguf \
/mnt/data/models/ubergarm/GLM-5-GGUF/GLM-5-smol-IQ4_NL.gguf \
IQ4_NL \
128
Thanks, so maybe my custom Q4_K code targeted at their QAT is working then.
I kinda expected it to be closer to BF16 after Kimi-K2-Thinking, but realised we never actually got the "real" BF16 of that model and could only compare back with the INT4 model they gave us!
I'm away from home and will take me several days to download GLM-5.1, but I posted the custom Q4_K code here:
https://github.com/ggml-org/llama.cpp/pull/19460#issuecomment-4200617220
GLM-5.1 just landed!!
Awaiting your magic π