colibrì: pure-C GLM-5.2 (744B MoE) engine with disk-streamed experts
Engine (c/glm.c): MLA attention with compressed KV, sigmoid noaux_tc router, int8/int4/int2 quant kernels (AVX2), per-layer LRU expert cache + pinned hot-store, batch-union MoE, native MTP speculative decoding (lossless), multi-stop + official chat template, RAM auto-budget from MemAvailable. Tokenizer: byte-level BPE in C. Tooling: coli CLI, disk-safe FP8→int4 converter, tiny-random oracle validation (TF 32/32, greedy 20/20). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pipeline GLM-5.2 (int4, streaming, 15 GB RAM) — tutto in WSL, modello su ext4.
|
||||
# uso: ./run.sh ["prompt"] [n_token]
|
||||
# Fa: (1) attende lo spostamento su ext4, (2) riprende la conversione fino a completarla,
|
||||
# (3) compila il motore, (4) genera testo restando nel budget RAM.
|
||||
set -euo pipefail
|
||||
|
||||
DIR=/home/vincenzo/glm52_i4 # modello int4 su ext4 (NON /mnt/c!)
|
||||
REPO=zai-org/GLM-5.2-FP8
|
||||
CODE=/mnt/c/Users/User/Desktop/moe-stream/c
|
||||
RAM_GB=15
|
||||
PROMPT="${1:-Ciao, chi sei?}"
|
||||
NGEN="${2:-64}"
|
||||
|
||||
cd "$CODE"
|
||||
|
||||
# 0) sanity: il modello deve stare su ext4, non su 9p/Windows
|
||||
case "$DIR" in /mnt/*) echo "ERRORE: $DIR e' su /mnt (9p/Windows). Mettilo su ext4."; exit 1;; esac
|
||||
|
||||
# 1) se un rsync di spostamento e' ancora vivo, aspettalo
|
||||
while pgrep -f "rsync.*glm52_i4" >/dev/null 2>&1; do
|
||||
echo "[1/4] attendo lo spostamento su ext4... ($(du -sh "$DIR" 2>/dev/null | cut -f1))"; sleep 20
|
||||
done
|
||||
echo "[1/4] spostamento completato: $(du -sh "$DIR" | cut -f1), shard $(ls "$DIR"/*.safetensors 2>/dev/null | wc -l)"
|
||||
|
||||
# 2) riprende+completa la conversione (ripartibile: salta gli shard gia' fatti)
|
||||
echo "[2/4] conversione (riprende da dove era): output -> $DIR"
|
||||
python3 convert_fp8_to_int4.py --repo "$REPO" --outdir "$DIR" --ebits 4 --io-bits 8
|
||||
|
||||
# 3) il motore richiede tokenizer.json + config.json nella dir del modello
|
||||
for f in config.json tokenizer.json; do
|
||||
[ -f "$DIR/$f" ] || { echo "ERRORE: manca $DIR/$f"; exit 1; }
|
||||
done
|
||||
echo "[3/4] compilo il motore"; make -s glm
|
||||
|
||||
# 4) generazione reale, con auto-cap dal budget RAM e heartbeat RSS su stderr
|
||||
echo "[4/4] genero (RAM_GB=$RAM_GB, NGEN=$NGEN)"; echo "------"
|
||||
SNAP="$DIR" RAM_GB="$RAM_GB" PROMPT="$PROMPT" NGEN="$NGEN" ./glm 64
|
||||
Reference in New Issue
Block a user