recipe.toml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # GLM-5.3-Flash EXL3 4bpw + DFlash2 on the Entrpi community image — 2× DGX
  2. # Spark, TP=2.
  3. #
  4. # NOT our lab stack: a fully different serving lane — 4-bit EXL3/TR3 fused
  5. # trellis MoE kernels (fork: Entrpi/vllm-glm-5.3-flash-spark, branch
  6. # glm53-on-infernal) with DFlash2 block-diffusion speculative decoding,
  7. # CUDA graphs (their validated default), 524k context over a packed-fp8
  8. # KV pool (~1.43M tokens). Upstream reference + numbers:
  9. # https://github.com/Entrpi/glm-5.3-flash-exl3-2x-spark
  10. # Image provenance: docs/BUILD.md in that repo. Image manifest digest
  11. # (arm64-only, checked via `docker manifest inspect`):
  12. # ghcr.io/entrpi/glm-5.3-flash-exl3-2x-spark:v1-dflash2
  13. # sha256:284142c5833cbfd540ad42bb8f32cb340451db05a3b84029eaebae54579e9135
  14. #
  15. # Model: brandonmusic/GLM-5.3-Flash-tr3-4bpw (EXL3/TR3 uniform-K4, ~176 GiB,
  16. # KLD parity with official FP8). Drafter: incoai/GLM-5.3-Flash-DFlash2
  17. # (CC BY-NC-ND 4.0 — non-commercial; keep to research/personal use).
  18. # DFlash2 drafter already cached site-wide; the EXL3 weights must be
  19. # downloaded once into the NAS hub (see PREREQUISITES).
  20. #
  21. # Flag provenance: parsed verbatim from the upstream
  22. # scripts/launch-glm53-vllm-tp2.sh defaults (validated production config).
  23. # DEVIATIONS from their kit — all forced by our launcher/fabric:
  24. # * no NCCL/*, master-addr/port, drop-caches ritual: the launcher handles
  25. # rendezvous + the [nccl.ds4] table + drop_caches (same ritual upstream).
  26. # * no --skip-mm-profiling... included; port = launcher 30000 convention
  27. # (their kit serves 8000; adjust --port if you must expose 8000).
  28. # * their hotfix-overlay hooks (glm53-hotfix etc.) are not used — this is
  29. # the shipped image as-is; re-add if tracking their issue tracker.
  30. # * weights stream from the NAS hub via HF_HOME (their kit prefers local
  31. # NVMe per box; NFS mode exists upstream too). First load is slow;
  32. # JIT caches persist per node (see extra_mounts).
  33. #
  34. # =====================================================================
  35. # STATUS 2026-08-30 (2nd entry): FIXED and verified serving on ds4.
  36. # ROOT CAUSE of the three OOM kills: the stock loader balloons ~80 GiB of
  37. # CPU-side anon buffers while streaming the 164 GiB checkpoint from the
  38. # NAS — unified memory (GPU pool + loader anon) hits the 121.6 GiB wall.
  39. # FIX: --load-format instanttensor (overlay image, this build context adds
  40. # instanttensor==0.1.9 --no-deps to the pinned Entrpi image): streams at
  41. # ~175 MB/s with tiny buffers; boot ~20 min end-to-end, no OOM (third+
  42. # boot clean at 16:40-17:00). Serving: ~22.8 tok/s with DFlash2 k=7
  43. # (accept 48-81% by content), math smoke exact. Recipe now builds its own
  44. # glm53-flash-exl3:local FROM the digest-pinned upstream image.
  45. # ---- first-entry diagnosis (kept for context) ----
  46. # boots fully to weight-stream, then global-OOM kills
  47. # the worker at 75-95% of shard load — REPRODUCED TWICE (12:22:25 and
  48. # 13:12:24, dmesg oom-killer) while streaming the 164 GiB checkpoint from
  49. # the shared NAS on BOTH nodes. GB10 unified memory + NFS page cache
  50. # cannot keep up (their kit streams NFS to the HEAD only; the worker reads
  51. # local NVMe, and even their local mode "wedges into swap at ~90%" by
  52. # their own caveat). Fixed knobs so far: entrypoint (NGC wrapper execs
  53. # first CMD arg as a file — `vllm serve` must be explicit), drafter repo
  54. # (incoai raw drafter is NOT in the NAS hub — we serve the MXFP8 mirror),
  55. # GMU 0.86 (their 0.85 left 1.14 GiB free when warmup wanted 1.12).
  56. # REMAINING FIX: per-node local mirror (sm121 --mirror after pointing
  57. # hf_cache_dir at the NAS). dgx3 has 400+ GiB free; dgx4 is 98% full —
  58. # blocked on local-cache cleanup there.
  59. #
  60. # Boot markers (engine log): "Model loading took ~88 GiB"-scale BEFORE any
  61. # EXL3 trellis lines → "GPU KV cache size" ≈ 1.4M tokens (fp8_e4m3 @524k)
  62. # → "Application startup complete". A "Setting attention block size to
  63. # 4608" line is expected (fp8 KV auto-bump, documented upstream).
  64. #
  65. # PREREQUISITES: weights cached on the NAS hub once:
  66. # docker run --rm --entrypoint python3 -v /mnt/nas/ai/huggingface:/root/.cache/huggingface \
  67. # glm53-flash-nvfp4-lab:local -c "from huggingface_hub import snapshot_download; \
  68. # snapshot_download('brandonmusic/GLM-5.3-Flash-tr3-4bpw')"
  69. # (DFlash2: already in the NAS hub.)
  70. engine = "vllm"
  71. name = "GLM-5.3-Flash EXL3-4bpw + DFlash2 (Entrpi image, 2x Spark, TP=2)"
  72. docker_image = "glm53-flash-exl3:local"
  73. docker_image_dir = "glm53-flash-exl3"
  74. model = "brandonmusic/GLM-5.3-Flash-tr3-4bpw"
  75. required_nodes = 2
  76. tensor_parallel_size = 2
  77. pipeline_parallel_size = 1
  78. distributed_backend = "mp"
  79. shm_size = "32gb"
  80. # The image's NGC entrypoint wrapper (/opt/nvidia/nvidia_entrypoint.sh)
  81. # execs the first CMD argument as a FILE unless it is a known command —
  82. # so `vllm serve` must be passed explicitly, as the upstream launch
  83. # script does (verified: first arg landed as a relative model path).
  84. entrypoint = ["vllm", "serve"]
  85. args = [
  86. # Stable served name — quant-agnostic (shared across glm53 quants)
  87. "--served-model-name", "glm53",
  88. "--trust-remote-code",
  89. # EXL3 fused trellis MoE (fork-baked kernels)
  90. "--quantization", "exl3",
  91. # instanttensor loader (installed by the overlay): streams shards with
  92. # tiny CPU buffers — the stock loader OOM-kills this box by ballooning
  93. # ~80 GiB anon while streaming 164 GiB from the NAS (3 kernel kills,
  94. # 2026-08-30). Also drops load time from ~13 min to ~1.
  95. "--load-format", "instanttensor",
  96. "--distributed-executor-backend", "mp",
  97. # Their validated defaults; 0.88+ risks unified-memory swap on GB10
  98. # 0.85 upstream default left 1.14 GiB when the warmup wanted 1.12 GiB
  99. # (OOM at engine init, 2026-08-30); 0.86 = one notch of slack. Their
  100. # 0.88+ warning is about swap wedging — 0.86 stays below that.
  101. "--gpu-memory-utilization", "0.86",
  102. "--max-model-len", "524288",
  103. "--max-num-seqs", "4",
  104. # vLLM auto-bumps to 4608 under fp8 KV (KDA state page parity)
  105. "--block-size", "2304",
  106. "--mm-processor-cache-gb", "0.5",
  107. "--max-num-batched-tokens", "8192",
  108. "--kv-cache-dtype", "fp8_e4m3",
  109. # 1,435,070-token pool at 524k fp8; do NOT raise (2.26 GiB floor @13.4e9)
  110. "--kv-cache-memory", "12400000000",
  111. # Drafter by hub id (resolved from the mounted NAS HF_HOME like the
  112. # target model; 7 = trained block size 8 minus the bonus token).
  113. # incoai/GLM-5.3-Flash-DFlash2 = the exact upstream drafter (raw
  114. # fp8-e4m3, CC BY-NC-ND 4.0), downloaded to the NAS hub 2026-08-30 at
  115. # the operator's request; the MXFP8 mirror is the fallback.
  116. "--speculative-config", """
  117. '{"method":"dflash","model":"incoai/GLM-5.3-Flash-DFlash2","num_speculative_tokens":7}'""",
  118. # required at 524288 on GB10 unified memory (upstream default SKIP_MM_PROFILING=1)
  119. "--skip-mm-profiling",
  120. "--tool-call-parser", "glm47",
  121. "--enable-auto-tool-choice",
  122. "--reasoning-parser", "glm45",
  123. "--default-chat-template-kwargs", """
  124. '{"enable_thinking": false}'""",
  125. ]
  126. [env]
  127. HF_HUB_OFFLINE = "1"
  128. TRANSFORMERS_OFFLINE = "1"
  129. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  130. PYTORCH_CUDA_ALLOC_CONF = "expandable_segments:True"
  131. TORCH_CUDA_ARCH_LIST = "12.1a"
  132. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  133. FLASHINFER_DISABLE_VERSION_CHECK = "1"
  134. VLLM_NO_USAGE_STATS = "1"
  135. # Weights + drafter both resolve out of the site NAS hub (offline mode).
  136. # NOTE: [[extra_mounts]] must stay AFTER args — a table header would
  137. # swallow the args array into it (TOML).
  138. [[extra_mounts]]
  139. host = "/mnt/nas/ai/huggingface"
  140. container = "/mnt/nas/ai/huggingface"
  141. env = "HF_HOME"
  142. # Long-lived JIT caches (upstream mounts $CACHE_HOST_PATH per layer);
  143. # hash-keyed so stale entries are inert, and first-boot compiles persist.
  144. [[extra_mounts]]
  145. host = "~/.cache/glm53-exl3-jit/triton"
  146. container = "/root/.triton"
  147. [[extra_mounts]]
  148. host = "~/.cache/glm53-exl3-jit/flashinfer"
  149. container = "/root/.cache/flashinfer"
  150. [[extra_mounts]]
  151. host = "~/.cache/glm53-exl3-jit/vllm"
  152. container = "/root/.cache/vllm"