GLM-5.2 (abliterated) on llama.cpp + opencode: two-pod workflow
Runs huihui-ai/Huihui-GLM-5.2-abliterated-GGUF (quant UD-Q3_K_M, 342.7 GB) with llama.cpp (CUDA) on
6x RTX PRO 6000 (96 GB) and chats with it through opencode. No building and no installing on the pods:
the CPU pod only downloads, the GPU pod only starts the server.
The model is an abliterated (refusal-reduced) build of zai-org/GLM-5.2 (MIT). The author left the first 12 layers
and all expert modules un-ablated, so refusal removal is partial. Outputs are unfiltered; review them.
(The repo name still says "ollama" for historical reasons: Ollama is not used any more. Its import copies the
model (about 2x the disk, ~55 min on a network volume) and I never confirmed it can load this architecture.)
The workflow
- Network volume: 400 GB in a datacenter that has 6x RTX PRO 6000. The CPU pod and the GPU pod must be in that
same datacenter, with the volume mounted at/workspace. (Check GPU availability there first.) - CPU pod (Ubuntu 24.04, volume at
/workspace):
Downloads the prebuilt llama.cpp, opencode, the config and the 9 shards (9 parallelcurl -fsSL https://huggingface.co/datasets/kopyl/glm52-ollama-setup/resolve/main/run.sh -o run.sh bash run.sh # no GPU found -> DOWNLOAD modecurlstreams, resumable),
then checks sizes and SHA-256 of every shard. Needs onlycurl,tar,zstd,sha256sum(already on Ubuntu images
I used). SetHF_TOKENonly if you hit rate limits; the repos are public. - GPU pod (6x RTX PRO 6000, Ubuntu 24.04, CUDA 12.8 image, same volume at
/workspace):
Checks the GPU/driver/CUDA libraries, startsbash /workspace/dl/run.sh # GPU found -> SERVE modellama-server(about 8 min to load), runs a smoke test and prints
how to open opencode:
Other commands:cd /workspace && /workspace/oc # model glm/glm52 is the defaultbash run.sh status,bash run.sh stop. Forcing a mode:bash run.sh download|serve.
After changing the context size, restart opencode too (its sidebar percentage uses opencode's ownlimit.context).
Doing it by hand (no script)
CPU pod:
mkdir -p /workspace/dl /workspace/home /workspace/models/glm52/UD-Q3_K_M /workspace/logs && cd /workspace/dl
BASE=https://huggingface.co/datasets/kopyl/glm52-ollama-setup/resolve/main
for f in llama-cpp-cuda-sm120-cu128-ubuntu2404.tar.zst opencode-1.19.4-linux-x64.tar.zst shards.sha256 serve_glm.sh opencode.json run.sh; do
curl -fL --retry 5 -O "$BASE/$f"; done
zstd -dc llama-cpp-cuda-sm120-cu128-ubuntu2404.tar.zst | tar -x --no-same-owner -C /workspace # -> /workspace/llama-cpp-cuda
zstd -dc opencode-1.19.4-linux-x64.tar.zst | tar -x --no-same-owner -C /workspace/home # -> /workspace/home/.opencode
mkdir -p /workspace/home/.config/opencode && cp opencode.json /workspace/home/.config/opencode/
SRC=https://huggingface.co/huihui-ai/Huihui-GLM-5.2-abliterated-GGUF/resolve/main/UD-Q3_K_M/GLM-5.2-UD-Q3_K_M
for n in 00001 00002 00003 00004 00005 00006 00007 00008 00009; do
curl -fL --retry 10 -C - -o /workspace/models/glm52/UD-Q3_K_M/GLM-5.2-UD-Q3_K_M-$n-of-00009.gguf "$SRC-$n-of-00009.gguf" &
done; wait
cd /workspace/models/glm52 && awk '{print $1" "$2}' /workspace/dl/shards.sha256 | sha256sum -c - # expect 9 x OK
GPU pod:
export LD_LIBRARY_PATH=/workspace/llama-cpp-cuda/bin:/usr/local/cuda/lib64 # any dir that has libcublas.so.12
nohup /workspace/llama-cpp-cuda/bin/llama-server \
-m /workspace/models/glm52/UD-Q3_K_M/GLM-5.2-UD-Q3_K_M-00001-of-00009.gguf -a glm52 \
-ngl 999 -sm layer -c 262144 -np 1 --jinja --no-warmup --host 127.0.0.1 --port 8099 > /workspace/logs/glm.log 2>&1 &
until curl -s http://127.0.0.1:8099/health | grep -q ok; do sleep 10; done # ~8 min
HOME=/workspace/home /workspace/home/.opencode/bin/opencode # model glm/glm52
Measured on 6x RTX PRO 6000 (driver 595.91.07, CUDA 12.8, Ubuntu 24.04; pod RAM limit 1.7 TB)
- Cold load: 7.8 min (a second cold load took about 8 min). GPU memory use was 51-61 GB per card at a 32k context (weights plus cache).
- Generation: 35-37 tokens/s on short prompts, 31 tokens/s at a 69k-token prompt. Prompt processing:
~1,800 tokens/s (5.6k-token prompt), ~1,380 tokens/s (69k-token prompt). - Context: the model is trained for 1,048,576 tokens. Going from 32,768 to 262,144 added 34,044 MiB in total
(~152 KiB per token). At 262,144 the busiest GPU uses 66,659 of 97,887 MiB. Default here is 262,144.
A 69,314-token prompt with a code word hidden at 40% was answered correctly. - opencode: connects to llama-server, and the model made a correct
bashtool call. - GLM writes its reasoning first and defaults to high reasoning effort, so open-ended prompts can spend many tokens thinking.
- Downloads (one pod): 1 stream ~119 MB/s, 8 parallel streams ~669 MB/s combined. A single 48.7 GB shard took ~7 min.
- All 9 shards matched the expected SHA-256 values; the sizes and hashes are in
shards.sha256.
| Context | KV cache | Status |
|---|---|---|
| 32,768 | ~4.8 GiB | derived from the measured 152 KiB/token |
| 262,144 | ~38 GiB | measured: +34,044 MiB in total versus 32,768 |
| 524,288 | ~76 GiB | extrapolated at 152 KiB/token, busiest GPU ~73,400 MiB; NOT tested |
| 1,048,576 | ~152 GiB | extrapolated, busiest GPU ~86,900 of 97,887 MiB; NOT tested, risky |
NOT verified
- The full two-step workflow on an empty volume has never been run end to end. Pieces were tested separately:
download mode on shards 8 and 9 in a clean directory (hash OK); serve mode in a clean directory against an
already-running server (everything except launching the server);setup.shprebuilt path on the 6x pod. - The server launch inside
run.sh serveafter the last fix (it now watches the launched PID). The same launch was
done by hand withserve_glm.shmany times. Test it once and delete this line. - A full 9-shard parallel download. One earlier run died silently at ~45 GB of shard 8 (script and curl vanished at the
same second, cause unknown, not reproduced); the rerun succeeded. - Other GPU types or counts,
--split-mode tensor,--load-mode dio, contexts above ~69k used for real, and thereasoning_effortsetting. Any other datacenter's volume speed.
Requirements and pitfalls
- Volume 400 GB: shards 342.7 GB + ~0.2 GB of tools. No Ollama copy and no merge needed.
- GPU pod RAM matters. llama.cpp maps the whole 343 GB file at load. On a pod with a 94 GB RAM limit the load
stalled (resident memory pinned at the limit, VRAM idle). On the 1.7 TB pod it worked. Use a pod whose RAM limit is
well above 350 GB, or tryLOAD_MODE=dio(untested). - The bundled llama.cpp only runs on compute capability 12.0 GPUs, Ubuntu 24.04 (glibc >= 2.39), with CUDA 12 runtime
libraries (libcublas.so.12).run.sh servechecks this and stops with a message. For other setups usesetup.sh
(builds llama.cpp from source: needsnvcc, CUDA >= 12.8 for Blackwell, and Python venv/pip; its build step
worked on the 6x pod (the whole run up to the opencode step took ~12 min), but the script was not re-run after the last ownership fix). - 5x/4x/8x GPU counts (arithmetic only): weights are 342.7 GB, so 4x80 GB does not fit, 5x80 GB is tight, 8x48 GB is tight
(~5 GB per card left), 6x96 GB is comfortable. - On the network volume, a file still being written shows size 0 and a killed download likely restarts from zero.
- opencode's search tools (grep/glob) need ripgrep. opencode downloads it on first use and unpacks it with
taras root;
on the network volume that fails withCannot change ownership to uid 1001 ... Operation not permitted, so the tools error out.
The bundle therefore shipsrgathome/.cache/opencode/bin/rg. If you ever see that error, put anrgbinary there
(extract it withtar --no-same-owner) and check it withopencode debug rg files. - Do not fill the 400 GB volume. The model is 342.7 GB, so only ~57 GB are spare. During testing, leftover copies of two
shards pushed a 400 GB volume over its quota (Disk quota exceeded), which breaks every write, including opencode's own. - The llama.cpp web UI is not included (its asset download failed at build time); the OpenAI-compatible API works.
- The server listens on 127.0.0.1 only and has no API key.
- GLM's tokenizer config logs a harmless-looking warning (
special_eot_id is not in special_eog_ids); no problem seen so far. - opencode's own prompt is ~7,000 tokens; contexts below 16k leave nothing for work.
- Permissions:
opencode.jsonsetsbash,edit,read,external_directoryandwebfetchtoallow, so agents are never
asked for permission. opencode runs asrooton these pods andsudoworks without a password (checked:sudo -n id -u-> 0).
Without the block, reading a file outside the working directory is refused/prompted. Consequence: an agent can delete
anything, including/workspaceand the model, and the model has no safety filtering. To get prompts back, delete thepermissionblock (or keep onlyexternal_directory). Checked withbashandread; the other keys were accepted by
opencode but not exercised, and whether sub-agents inherit them was not tested.
Files in this repo
| File | Purpose |
|---|---|
run.sh |
the one script: download mode (CPU pod) and serve mode (GPU pod), plus status and stop |
llama-cpp-cuda-sm120-cu128-ubuntu2404.tar.zst (51.9 MB) |
prebuilt llama.cpp (commit df9beac), has its own MANIFEST.txt |
opencode-1.19.4-linux-x64.tar.zst (79.3 MB) |
opencode binary + provider package + ripgrep 15.1.0 (see pitfalls) |
serve_glm.sh, opencode.json |
server launch settings and opencode config (model glm/glm52, context 262,144) |
shards.sha256 |
expected SHA-256 and size of each shard |
setup.sh |
fallback: builds llama.cpp from source and installs opencode (other GPUs / images) |
The shards themselves come from huihui-ai/Huihui-GLM-5.2-abliterated-GGUF, not from this repo. If that repo changes or
disappears, the download fails.
TODO
- Run the whole workflow on an empty volume (CPU pod, then GPU pod) and fix what breaks; then delete the "NOT verified" lines it covers.
- Test
LOAD_MODE=dio,--split-mode tensor, and a larger context (524,288) on 6x RTX PRO 6000. - Try a lower reasoning effort (
--chat-template-kwargs) if answers are too slow. - Rename this repo (the name says "ollama").
- Revoke the Hugging Face write token that was used for uploads.