Instructions to use anemll/GLM-5.2-sidecar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use anemll/GLM-5.2-sidecar with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="anemll/GLM-5.2-sidecar", filename="dense/model-dense.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use anemll/GLM-5.2-sidecar 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 anemll/GLM-5.2-sidecar # Run inference directly in the terminal: llama cli -hf anemll/GLM-5.2-sidecar
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf anemll/GLM-5.2-sidecar # Run inference directly in the terminal: llama cli -hf anemll/GLM-5.2-sidecar
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 anemll/GLM-5.2-sidecar # Run inference directly in the terminal: ./llama-cli -hf anemll/GLM-5.2-sidecar
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 anemll/GLM-5.2-sidecar # Run inference directly in the terminal: ./build/bin/llama-cli -hf anemll/GLM-5.2-sidecar
Use Docker
docker model run hf.co/anemll/GLM-5.2-sidecar
- LM Studio
- Jan
- Ollama
How to use anemll/GLM-5.2-sidecar with Ollama:
ollama run hf.co/anemll/GLM-5.2-sidecar
- Unsloth Studio
How to use anemll/GLM-5.2-sidecar 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 anemll/GLM-5.2-sidecar 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 anemll/GLM-5.2-sidecar to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for anemll/GLM-5.2-sidecar to start chatting
- Pi
How to use anemll/GLM-5.2-sidecar with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anemll/GLM-5.2-sidecar
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": "anemll/GLM-5.2-sidecar" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use anemll/GLM-5.2-sidecar with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anemll/GLM-5.2-sidecar
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 anemll/GLM-5.2-sidecar
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use anemll/GLM-5.2-sidecar with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf anemll/GLM-5.2-sidecar
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 "anemll/GLM-5.2-sidecar" \ --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 anemll/GLM-5.2-sidecar with Docker Model Runner:
docker model run hf.co/anemll/GLM-5.2-sidecar
- Lemonade
How to use anemll/GLM-5.2-sidecar with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull anemll/GLM-5.2-sidecar
Run and chat with the model
lemonade run user.GLM-5.2-sidecar-{{QUANT_TAG}}List all available models
lemonade list
Add model card: download + build + test (--slot8) instructions
Browse files
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: glm-5.2
|
| 4 |
+
tags:
|
| 5 |
+
- gguf
|
| 6 |
+
- moe
|
| 7 |
+
- glm
|
| 8 |
+
- flash-moe
|
| 9 |
+
- llama.cpp
|
| 10 |
+
- metal
|
| 11 |
+
library_name: llama.cpp
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# GLM-5.2 Flash-MoE Sidecar (UD-IQ1_M)
|
| 15 |
+
|
| 16 |
+
SSD-streamed Mixture-of-Experts **expert sidecar** for **GLM-5.2** (Unsloth Dynamic `UD-IQ1_M`),
|
| 17 |
+
built for the **Flash-MoE slot-bank** runtime in the
|
| 18 |
+
[`anemll/flash-llama.cpp`](https://github.com/Anemll/anemll-flash-llama.cpp/tree/GLM-5.2-Moe) fork.
|
| 19 |
+
|
| 20 |
+
The routed experts are stored as per-layer `layer_*.bin` files and streamed from SSD on demand into
|
| 21 |
+
a small resident **slot bank** during decode, so the full MoE runs on a unified-memory Mac without
|
| 22 |
+
keeping every expert in RAM. The dense / shared weights live in a separate small GGUF.
|
| 23 |
+
|
| 24 |
+
## What's in this repo
|
| 25 |
+
|
| 26 |
+
| Path | Size | Description |
|
| 27 |
+
|------|------|-------------|
|
| 28 |
+
| `dense/model-dense.gguf` | ~15.5 GB | Dense + shared weights, router, attention (the model you pass to `-m`) |
|
| 29 |
+
| `dense/flashmoe-package.json` | — | Flash-MoE package descriptor |
|
| 30 |
+
| `layer_003.bin` … `layer_NNN.bin` | ~213 GB total | Per-layer routed-expert tensors (IQ1_M), streamed on demand |
|
| 31 |
+
| `manifest.json` | — | Sidecar manifest (tensor map, quant types, byte offsets) |
|
| 32 |
+
|
| 33 |
+
**Model facts:** arch `glm-dsa`, 256 routed experts, top-8 per token, 3 leading dense layers,
|
| 34 |
+
`n_embd = 6144`, routed `n_ff = 2048`, experts quantized `IQ1_M`. Layout: `layer_major_whole_tensor`.
|
| 35 |
+
|
| 36 |
+
> Total download is ~**213 GB**. You need a fast SSD; decode is I/O-bound on expert streaming.
|
| 37 |
+
|
| 38 |
+
## Download
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
hf download anemll/GLM-5.2-sidecar --repo-type model --local-dir ~/Models/GLM-5.2-sidecar
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Build the runtime (Apple Metal)
|
| 45 |
+
|
| 46 |
+
This sidecar requires the Flash-MoE fork on the **`GLM-5.2-Moe`** branch:
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
git clone -b GLM-5.2-Moe https://github.com/Anemll/anemll-flash-llama.cpp
|
| 50 |
+
cd anemll-flash-llama.cpp
|
| 51 |
+
cmake -B build -DGGML_METAL=ON
|
| 52 |
+
cmake --build build --config Release -j --target llama-cli
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Run / test
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
./build/bin/llama-cli --perf \
|
| 59 |
+
-m ~/Models/GLM-5.2-sidecar/dense/model-dense.gguf \
|
| 60 |
+
--moe-mode slot-bank \
|
| 61 |
+
--moe-sidecar ~/Models/GLM-5.2-sidecar/ \
|
| 62 |
+
--moe-verify-sidecar \
|
| 63 |
+
--moe-slot-bank 64 \
|
| 64 |
+
--moe-topk 8 \
|
| 65 |
+
--moe-cache-io-split 2 \
|
| 66 |
+
--moe-prefetch-temporal \
|
| 67 |
+
-fit on \
|
| 68 |
+
-ub 1 -b 64 \
|
| 69 |
+
-ngl 999 \
|
| 70 |
+
-c 512 \
|
| 71 |
+
--seed 123 --temp 0 \
|
| 72 |
+
-p "What is Apple Neural Engine? Answer in one sentence." \
|
| 73 |
+
-n 2000 -st \
|
| 74 |
+
--slot8
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### `--slot8` (fused single-kernel routed FFN)
|
| 78 |
+
|
| 79 |
+
This branch adds `--slot8`, which collapses the whole routed FFN — gate, up, SwiGLU, down, and the
|
| 80 |
+
routed weighted-sum over all selected experts — into a **single fused op** (two Metal kernels,
|
| 81 |
+
IQ1_M) for single-token decode. It reads the resident slot ids once at encode time, so the
|
| 82 |
+
per-expert `mul_mat_id` decode replay / ICB cache is no longer used on that path. Output is
|
| 83 |
+
validated byte-identical to the unfused reference path.
|
| 84 |
+
|
| 85 |
+
Toggles:
|
| 86 |
+
- `--slot8` / `--no-slot8` — enable/disable the fused path (only engages on eligible top-k decode layers).
|
| 87 |
+
- `LLAMA_FLASH_MOE_SLOT8_REFERENCE=1` — force the `mul_mat` reference path (A/B comparison / fallback).
|
| 88 |
+
- `LLAMA_FLASH_MOE_SLOT8_DEBUG=1` — log which layers take the fused path.
|
| 89 |
+
|
| 90 |
+
> Tested on Apple M5 Max (128 GB). `--slot8` is a decode-only fast path; prefill and non-eligible
|
| 91 |
+
> layers use the normal slot-bank route.
|
| 92 |
+
|
| 93 |
+
## License
|
| 94 |
+
|
| 95 |
+
Derived from **GLM-5.2** (Z.ai / Zhipu AI). Use is subject to the original GLM-5.2 model license;
|
| 96 |
+
this sidecar only repackages those weights for SSD-streamed inference.
|