Instructions to use andreaborio/GLM-5.2-DS4-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use andreaborio/GLM-5.2-DS4-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="andreaborio/GLM-5.2-DS4-GGUF", filename="GLM-5.2-DS4-ExpertMajor-v2-Q2_K.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 andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF:Q2_K # Run inference directly in the terminal: llama cli -hf andreaborio/GLM-5.2-DS4-GGUF:Q2_K
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf andreaborio/GLM-5.2-DS4-GGUF:Q2_K # Run inference directly in the terminal: llama cli -hf andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF:Q2_K # Run inference directly in the terminal: ./llama-cli -hf andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF:Q2_K # Run inference directly in the terminal: ./build/bin/llama-cli -hf andreaborio/GLM-5.2-DS4-GGUF:Q2_K
Use Docker
docker model run hf.co/andreaborio/GLM-5.2-DS4-GGUF:Q2_K
- LM Studio
- Jan
- vLLM
How to use andreaborio/GLM-5.2-DS4-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "andreaborio/GLM-5.2-DS4-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": "andreaborio/GLM-5.2-DS4-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/andreaborio/GLM-5.2-DS4-GGUF:Q2_K
- Ollama
How to use andreaborio/GLM-5.2-DS4-GGUF with Ollama:
ollama run hf.co/andreaborio/GLM-5.2-DS4-GGUF:Q2_K
- Unsloth Studio
How to use andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for andreaborio/GLM-5.2-DS4-GGUF to start chatting
- Pi
How to use andreaborio/GLM-5.2-DS4-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf andreaborio/GLM-5.2-DS4-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": "andreaborio/GLM-5.2-DS4-GGUF:Q2_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF:Q2_K
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use andreaborio/GLM-5.2-DS4-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf andreaborio/GLM-5.2-DS4-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 "andreaborio/GLM-5.2-DS4-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 andreaborio/GLM-5.2-DS4-GGUF with Docker Model Runner:
docker model run hf.co/andreaborio/GLM-5.2-DS4-GGUF:Q2_K
- Lemonade
How to use andreaborio/GLM-5.2-DS4-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull andreaborio/GLM-5.2-DS4-GGUF:Q2_K
Run and chat with the model
lemonade run user.GLM-5.2-DS4-GGUF-Q2_K
List all available models
lemonade list
GLM-5.2 DS4 GGUF releases
This is the definitive versioned GLM-5.2 model container for
andreaborio/ds4. The current release is
one qualified ExpertMajor v2 GGUF. The older chunked diagnostic artifact and
its sidecar are retained only as historical experimental evidence.
Versions
| Artifact | Status | Runtime |
|---|---|---|
GLM-5.2-DS4-ExpertMajor-v2-Q2_K.gguf |
Current | DS4 main at 57acfd4 or newer |
glm52-ds4-native-64g.gguf.part-000 through part-005 |
Legacy experimental diagnostic | Retired preview branch only; rejected by current DS4 inference |
sidecars/selected-hotlist-n32-pack2600/ |
Legacy sidecar experiment | Retired; never selected by current DS4 |
DSBox and the root dsbox.json select only the single-file ExpertMajor v2
release. The legacy files remain available for reproducibility and historical
links; they are not fallback formats. Current DS4 provides no compatibility
path for the old chunked canonical layout or its sidecar.
The current file embeds the routed MoE bank once as
ds4.expert_major.v2. It needs no sidecar, startup repack, or second copy of
the routed weights. It is intentionally DS4-only: llama.cpp, MLX, Ollama, and
other generic GGUF loaders cannot execute it.
Current artifact
| Property | Value |
|---|---|
| Base model | zai-org/GLM-5.2 |
| File | GLM-5.2-DS4-ExpertMajor-v2-Q2_K.gguf |
| Size | 262,147,193,504 bytes (244.14 GiB) |
| SHA-256 | 7f5017e3076e706c78f2a5322b035a9e2f6519c65ff5b6be8b2d91aeff61505d |
| Container | GGUF v3 with one embedded ds4.expert_major.v2 store |
| Tensor inventory | 1,297 physical tensors; 1,524 logical tensors reconstructed by DS4 |
| Routed geometry | 76 routed layers, 256 experts per layer, top-8 |
| Expert record | gate + up + down, 12,386,304 contiguous bytes |
| Routed payload | 240,987,930,624 bytes (224.44 GiB) |
| Routed payload SHA-256 | 122dcd3185037a3c0bcc8abab18ef61203ecfbfd2b25d02bd01e49c48778dfa9 |
| Qualified hardware | Apple Silicon Metal, at least 64 GiB unified memory |
The v2 conversion changes routed-weight order and the GGUF tensor directory without requantizing values. Non-routed payloads are copied from the byte-identified source and routed weights are stored once.
Run with DS4
Use andreaborio/ds4 main at commit
57acfd408a3154851a0c59be432904300abb3b6c
or a compatible descendant:
git clone https://github.com/andreaborio/ds4.git
cd ds4
make -j
./ds4 \
-m /absolute/path/to/GLM-5.2-DS4-ExpertMajor-v2-Q2_K.gguf \
--ctx 8192
The runtime automatically selects Metal, SSD residency, the GLM profile, contiguous-record expert reads, compact DSA KV, and the qualified cache policy. No Metal, SSD, cache, preload, full-layer, sidecar, or ExpertMajor flag is needed.
Measured performance
The release lane used an Apple M5 Pro with 64 GiB unified memory, local APFS storage, context 8192, an exact 288-token prompt, and 32 greedy output tokens:
| Runtime arm | Prefill | Decode |
|---|---|---|
| Clean agent-friendly v2-only refactor | 11.89 t/s | 1.84 t/s |
| Post-unification v2-only gate | 11.20 t/s | 1.82 t/s |
| Earlier public-command gates | 10.63-10.91 t/s | 1.77-1.79 t/s |
| Prior rested-storage qualification, median | 11.075 t/s | 1.900 t/s |
Every accepted arm produced the same deterministic continuation. These are bounded local measurements, not universal throughput guarantees.
The final compact-indexer correction was also exercised at 32K on the same 64 GiB host. The prose lane measured 44.73 t/s prefill, 1.87 t/s overall decode, and 472.624/621.302 ms TPOT p50/p95; p50 corresponds to about 2.12 t/s steady decode. A separate security/coding prompt measured 45.53/1.33 t/s because its expert-cache hit rate fell from 36.90% to 13.15%. Both runs completed with zero new swapout and exact retained evidence. The original baseline fails the 32K transition before logits, so this is a correctness qualification rather than a speedup claim.
Legacy experimental artifact
The retained diagnostic source reconstructs to
glm52-ds4-native-64g.gguf, 262,147,189,920 bytes, SHA-256
99e18cf31620845f6ff8e08ec8074865b613a3684383fa53ebb93e77260d7dd5.
It is stored as six part-000 through part-005 files with checksum manifests
and reconstruct.sh. The optional 32,204,390,400-byte selected-hotlist sidecar
is also historical. Neither layout is supported by current DS4 inference.
These files document the early CPU/preview and selected-hotlist bring-up that
preceded the embedded ExpertMajor v2 store. Keep them for reproducibility; do
not use their old startup commands with current main.
Limitations
- Minimum qualified memory is 64 GiB unified memory.
- One complete local ExpertMajor v2 file and Apple Metal SSD streaming are mandatory.
- 8K is the normal 64 GiB starting point and 32K is qualified but slow to test; no 65K/100K GLM claim is made because this release does not change attention, KV geometry, RoPE, or context scaling.
- MTP/speculative decoding remains disabled because measured acceptance did not repay its additional expert I/O.
- Performance depends on storage state, memory pressure, context length, routing locality, and thermals.
License and attribution
GLM-5.2 is released by Z.ai under the MIT license. See the upstream model card
for architecture, training, safety, and attribution details. The historical
runtime work credits antirez/ds4 and
andreaborio/ds4.
- Downloads last month
- 98
2-bit
Model tree for andreaborio/GLM-5.2-DS4-GGUF
Base model
zai-org/GLM-5.2