|
@@ -9,52 +9,36 @@
|
|
|
# reconstruction error vs E2M1/MXFP4 baseline on the same GPTQ pipeline).
|
|
# reconstruction error vs E2M1/MXFP4 baseline on the same GPTQ pipeline).
|
|
|
# Codes are indices into per-layer grids/L{n}.json — NOT the E2M1 table.
|
|
# Codes are indices into per-layer grids/L{n}.json — NOT the E2M1 table.
|
|
|
#
|
|
#
|
|
|
-# LOADING: the Lloyd repo is experts-only (L{n}.safetensors + grids/). It
|
|
|
|
|
-# cannot be served standalone. The base checkpoint is
|
|
|
|
|
-# aidendle94/GLM-5.2-MXFP4-Experts-GPTQ (full model: config.json with
|
|
|
|
|
-# quant_method="hybrid_mxfp4_ct", hybrid-ct-*.safetensors non-expert weights
|
|
|
|
|
-# in block-FP8/NVFP4, tokenizer, mtp-draft). The Lloyd NF4 experts REPLACE
|
|
|
|
|
-# the MXFP4 E2M1 experts for layers 3–77 (all 75 MoE layers): the Lloyd
|
|
|
|
|
-# L{n}.safetensors files have the same filenames and tensor names as the
|
|
|
|
|
-# MXFP4 repo's, so they must be copied into the MXFP4 snapshot directory
|
|
|
|
|
-# (filesystem overlay). vLLM loads them through the standard weight loader;
|
|
|
|
|
-# the nf4_e8m0_k32 kernel (baked in production-hybrid-1.4) decodes them with
|
|
|
|
|
-# the global _NF4_CODEBOOK instead of the E2M1 bit-twiddle. Which layers use
|
|
|
|
|
-# the NF4 path is controlled by VLLM_NF4_LAYERS — a path to a JSON file
|
|
|
|
|
-# {"layers": [3, 4, ..., 77]}, NOT a range string.
|
|
|
|
|
|
|
+# LOADING via [composed_model]: the Lloyd repo is experts-only (no config,
|
|
|
|
|
+# no tokenizer, no non-expert weights). The launcher builds a /tmp dir per
|
|
|
|
|
+# node with symlinks into the HF cache and bind-mounts it at /root/model:
|
|
|
|
|
+# 1. aidendle94/GLM-5.2-MXFP4-Experts-GPTQ (base checkpoint — config.json
|
|
|
|
|
+# with quant_method="hybrid_mxfp4_ct", hybrid-ct-*.safetensors non-expert
|
|
|
|
|
+# weights, tokenizer, mtp-draft) → all files symlinked.
|
|
|
|
|
+# 2. aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ (Lloyd NF4 experts) →
|
|
|
|
|
+# L*.safetensors symlinked, OVERWRITING the MXFP4 E2M1 experts
|
|
|
|
|
+# (later sources win). Same filenames, same tensor names — the Lloyd
|
|
|
|
|
+# codes replace the E2M1 codes.
|
|
|
|
|
+# 3. nf4_layers.json (generated) — tells the kernel which layers use the
|
|
|
|
|
+# nf4_e8m0_k32 decode path vs the default fp4_e8m0_k32 E2M1 bit-twiddle.
|
|
|
|
|
+#
|
|
|
|
|
+# The symlinks point to container-side paths (/root/.cache/huggingface/...)
|
|
|
|
|
+# so they resolve inside the container where the HF cache is mounted. The
|
|
|
|
|
+# _NF4_CODEBOOK is GLOBAL and hardcoded in the b12x binary (fitted as the
|
|
|
|
|
+# mean of 71 per-layer Lloyd–Max tables) — the per-layer grids/L{n}.json
|
|
|
|
|
+# files are reference artifacts, NOT loaded at runtime.
|
|
|
#
|
|
#
|
|
|
# Image: sparkrun-vllm-ds4-gb10:glm52
|
|
# Image: sparkrun-vllm-ds4-gb10:glm52
|
|
|
# Built from docker-images/glm52/Dockerfile, which FROMs
|
|
# Built from docker-images/glm52/Dockerfile, which FROMs
|
|
|
# aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.4 (bakes the
|
|
# aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.4 (bakes the
|
|
|
# nf4_e8m0_k32 / nf4_packed kernel — inert without VLLM_NF4_LAYERS).
|
|
# nf4_e8m0_k32 / nf4_packed kernel — inert without VLLM_NF4_LAYERS).
|
|
|
#
|
|
#
|
|
|
-# PREREQUISITES (manual, on EVERY node):
|
|
|
|
|
-# 1. Download both repos via HF_HOME:
|
|
|
|
|
-# huggingface-cli download aidendle94/GLM-5.2-MXFP4-Experts-GPTQ
|
|
|
|
|
-# huggingface-cli download aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ
|
|
|
|
|
-# (MXFP4 base ~390 GB, Lloyd experts ~385 GB)
|
|
|
|
|
-# 2. Overlay the Lloyd NF4 experts onto the MXFP4 snapshot directory (same
|
|
|
|
|
-# filenames, same tensor names — they replace the E2M1 experts with
|
|
|
|
|
-# NF4-packed codes). Use RELATIVE symlinks (ln -snrf), not copies: the
|
|
|
|
|
-# HF cache is mounted at /root/.cache/huggingface inside the container
|
|
|
|
|
-# (vs /home/<user>/.cache/huggingface on the host), so absolute symlinks
|
|
|
|
|
-# would break — relative paths resolve the same under both roots, like
|
|
|
|
|
-# HF's own snapshot→blob links. -n is critical: it stops ln from
|
|
|
|
|
-# dereferencing the existing MXFP4 symlink (without -n, ln would replace
|
|
|
|
|
-# the BLOB the link points to, corrupting the 390 GB MXFP4 cache).
|
|
|
|
|
-# Lightweight: ~75 symlinks, no 385 GB copy.
|
|
|
|
|
-# MXFP4=$(readlink -f ~/.cache/huggingface/hub/models--aidendle94--GLM-5.2-MXFP4-Experts-GPTQ/snapshots/main)
|
|
|
|
|
-# LLOYD=$(readlink -f ~/.cache/huggingface/hub/models--aidendle94--GLM-5.2-NF4-Lloyd-Experts-GPTQ/snapshots/main)
|
|
|
|
|
-# for f in "$LLOYD"/L*.safetensors; do ln -snrf "$f" "$MXFP4/$(basename "$f")"; done
|
|
|
|
|
-# Without this overlay the kernel decodes E2M1 weights with the NF4
|
|
|
|
|
-# codebook → garbage output (the model card warns about this).
|
|
|
|
|
-# 3. Create the NF4 layer-list JSON in the Lloyd snapshot dir (the kernel
|
|
|
|
|
-# reads this via VLLM_NF4_LAYERS — {{lloyd_experts}}/nf4_layers.json):
|
|
|
|
|
-# echo "{\"layers\":[$(seq -s, 3 77)]}" > "$LLOYD"/nf4_layers.json
|
|
|
|
|
-#
|
|
|
|
|
-# REFERENCE:
|
|
|
|
|
-# https://huggingface.co/aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ
|
|
|
|
|
-# https://huggingface.co/aidendle94/GLM-5.2-MXFP4-Experts-GPTQ
|
|
|
|
|
|
|
+# PREREQUISITES:
|
|
|
|
|
+# - Both repos cached on every node via HF_HOME:
|
|
|
|
|
+# huggingface-cli download aidendle94/GLM-5.2-MXFP4-Experts-GPTQ
|
|
|
|
|
+# huggingface-cli download aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ
|
|
|
|
|
+# (MXFP4 base ~390 GB, Lloyd experts ~385 GB)
|
|
|
|
|
+# No manual overlay or JSON creation — [composed_model] handles everything.
|
|
|
|
|
|
|
|
engine = "vllm"
|
|
engine = "vllm"
|
|
|
name = "GLM-5.2 NF4 Lloyd-Experts-GPTQ (vLLM)"
|
|
name = "GLM-5.2 NF4 Lloyd-Experts-GPTQ (vLLM)"
|
|
@@ -95,10 +79,10 @@ args = [
|
|
|
"--max-num-seqs", "3",
|
|
"--max-num-seqs", "3",
|
|
|
"--gpu-memory-utilization", "0.89",
|
|
"--gpu-memory-utilization", "0.89",
|
|
|
# Speculative decode — MTP k=4 with adaptive depths
|
|
# Speculative decode — MTP k=4 with adaptive depths
|
|
|
- # {{mtp_draft}} is substituted per-node with the resolved HF cache path
|
|
|
|
|
- # (refs/main → latest snapshot) so symlinks resolve correctly.
|
|
|
|
|
|
|
+ # /root/model/mtp-draft is symlinked from the MXFP4 base checkpoint
|
|
|
|
|
+ # (the composed dir includes it via source #1).
|
|
|
"--speculative-config", """
|
|
"--speculative-config", """
|
|
|
-'{"model":"{{mtp_draft}}","method":"mtp","num_speculative_tokens":4,"draft_attention_backend":"B12X_MLA_SPARSE","adaptive_speculative_tokens_window":32}'""",
|
|
|
|
|
|
|
+'{"model":"/root/model/mtp-draft","method":"mtp","num_speculative_tokens":4,"draft_attention_backend":"B12X_MLA_SPARSE","adaptive_speculative_tokens_window":32}'""",
|
|
|
# Compilation — FULL_AND_PIECEWISE with all custom ops, 8 capture sizes
|
|
# Compilation — FULL_AND_PIECEWISE with all custom ops, 8 capture sizes
|
|
|
"--compilation-config", """
|
|
"--compilation-config", """
|
|
|
'{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"],"cudagraph_capture_sizes":[1,2,3,4,5,6,8]}'""",
|
|
'{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"],"cudagraph_capture_sizes":[1,2,3,4,5,6,8]}'""",
|
|
@@ -107,6 +91,20 @@ args = [
|
|
|
"--cpu-distributed-timeout-seconds", "3600",
|
|
"--cpu-distributed-timeout-seconds", "3600",
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+[composed_model]
|
|
|
|
|
+mount = "/root/model"
|
|
|
|
|
+
|
|
|
|
|
+[[composed_model.sources]]
|
|
|
|
|
+repo = "aidendle94/GLM-5.2-MXFP4-Experts-GPTQ"
|
|
|
|
|
+
|
|
|
|
|
+[[composed_model.sources]]
|
|
|
|
|
+repo = "aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ"
|
|
|
|
|
+glob = "L*.safetensors"
|
|
|
|
|
+
|
|
|
|
|
+[[composed_model.files]]
|
|
|
|
|
+name = "nf4_layers.json"
|
|
|
|
|
+content = '{"layers":[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77]}'
|
|
|
|
|
+
|
|
|
# Persistent JIT/torch-inductor cache (avoids ~20 min recompilation on cold boot).
|
|
# Persistent JIT/torch-inductor cache (avoids ~20 min recompilation on cold boot).
|
|
|
# `alias = "jit_cache"` resolves via [mount_aliases] in config.toml; if absent,
|
|
# `alias = "jit_cache"` resolves via [mount_aliases] in config.toml; if absent,
|
|
|
# falls back to host "~/.cache/jit" (expanded to /home/<ssh_user>/.cache/jit).
|
|
# falls back to host "~/.cache/jit" (expanded to /home/<ssh_user>/.cache/jit).
|
|
@@ -117,37 +115,13 @@ host = "~/.cache/jit"
|
|
|
container = "/root/.cache/jit"
|
|
container = "/root/.cache/jit"
|
|
|
env = "XDG_CACHE_HOME"
|
|
env = "XDG_CACHE_HOME"
|
|
|
|
|
|
|
|
-# MTP draft model — from the MXFP4 base checkpoint's repo. Resolved at serve
|
|
|
|
|
-# time, per node, from the HF cache (refs/main → latest snapshot), so the
|
|
|
|
|
-# path survives `huggingface-cli download` updates without a fragile symlink.
|
|
|
|
|
-# The recipe references {{mtp_draft}} in --speculative-config; the launcher
|
|
|
|
|
-# substitutes the resolved full HF cache path per-node (no bind-mount — the
|
|
|
|
|
-# HF cache is already mounted at /root/.cache/huggingface, so symlinks
|
|
|
|
|
-# resolve correctly).
|
|
|
|
|
-[[extra_mounts]]
|
|
|
|
|
-repo = "aidendle94/GLM-5.2-MXFP4-Experts-GPTQ"
|
|
|
|
|
-subfolder = "mtp-draft"
|
|
|
|
|
-container = "mtp_draft"
|
|
|
|
|
-
|
|
|
|
|
-# Lloyd repo path reference — resolved at serve time, per node, from the HF
|
|
|
|
|
-# cache (refs/main → latest snapshot). {{lloyd_experts}} is substituted into
|
|
|
|
|
-# VLLM_NF4_LAYERS below so the kernel can find the nf4_layers.json file
|
|
|
|
|
-# (created by the operator in step 3 of the prerequisites above). This is a
|
|
|
|
|
-# path reference, NOT a bind-mount — the HF cache is already mounted at
|
|
|
|
|
-# /root/.cache/huggingface, so the resolved path's symlinks resolve correctly.
|
|
|
|
|
-[[extra_mounts]]
|
|
|
|
|
-repo = "aidendle94/GLM-5.2-NF4-Lloyd-Experts-GPTQ"
|
|
|
|
|
-container = "lloyd_experts"
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
[env]
|
|
[env]
|
|
|
# ── NF4 Lloyd expert overlay ──────────────────────────────────────────────
|
|
# ── NF4 Lloyd expert overlay ──────────────────────────────────────────────
|
|
|
# Path to a JSON file listing which layers use the nf4_e8m0_k32 decode path
|
|
# Path to a JSON file listing which layers use the nf4_e8m0_k32 decode path
|
|
|
-# (vs the default fp4_e8m0_k32 E2M1 bit-twiddle). The kernel reads this file
|
|
|
|
|
-# at init: {"layers": [3, 4, ..., 77]}. {{lloyd_experts}} is substituted
|
|
|
|
|
-# per-node with the resolved HF cache path to the Lloyd repo snapshot, where
|
|
|
|
|
-# the operator creates nf4_layers.json (see PREREQUISITES step 3 above).
|
|
|
|
|
-VLLM_NF4_LAYERS = "{{lloyd_experts}}/nf4_layers.json"
|
|
|
|
|
|
|
+# (vs the default fp4_e8m0_k32 E2M1 bit-twiddle). Generated by [composed_model]
|
|
|
|
|
+# at /root/model/nf4_layers.json — no placeholder needed (known container path).
|
|
|
|
|
+VLLM_NF4_LAYERS = "/root/model/nf4_layers.json"
|
|
|
|
|
|
|
|
# ── b12x suite ────────────────────────────────────────────────────────────
|
|
# ── b12x suite ────────────────────────────────────────────────────────────
|
|
|
VLLM_USE_V2_MODEL_RUNNER = "1"
|
|
VLLM_USE_V2_MODEL_RUNNER = "1"
|