recipe.toml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # DeepSeek-V4.1-Flash EXL3 3bpw — coolbho3k "2x DGX Spark" production recipe,
  2. # adapted to sm121 (rc2 image, pinned at release commit 878e0ee).
  3. #
  4. # 2x Spark over 200G RoCE (8nodes-switch, first two free ranks):
  5. # TP2/DCP2, DSpark K=3 drafter, EXL3 3bpw experts, FP4 main KV + FP8 SWA,
  6. # 1M context, GMU 0.92, max-num-seqs 2 (C2; the runtime's cooperative
  7. # profile validates 1..6), prefill batch 3072.
  8. #
  9. # 2 GB headless-RAM unlock: the runtime's display-pool KV (1.75 GiB of the
  10. # firmware's 2 GB display reserve per GPU) needs nvidia_drm remoded with
  11. # modeset=1 fbdev=0. That is TEMPORARY by design (technology still in
  12. # approval): before_serve remods per boot, after_stop restores the plain
  13. # module. No UEFI change, no /etc/modprobe.d entry, resets on reboot.
  14. #
  15. # Model + drafter overlay: node-local NVMe mirror of the NAS hub at
  16. # /home/kilork/hf-local/hub (EXL3 streams weights on EVERY decode step — from
  17. # NFS that costs ~2/3 of decode; staged here per node, the read is local).
  18. # Mirror rule: same hub-root-relative layout; refs/main stays pinned to the
  19. # NAS (authoritative). Files not staged locally — engram-page15-v1 (optional
  20. # per its release notes, +1.4% decode) — resolve through the NAS fallback,
  21. # read-only. The launch nodes bind every referenced file per-path at /model
  22. # and /draft-exl3 (the runtime hard-requires the model at exactly /model).
  23. #
  24. # Cgroup: the runtime's serving guard hard-requires a 9 GiB / no-swap /
  25. # <=6-CPU cgroup (memory.max==9g, swap 0, cpu quota <=6) — memory_limit +
  26. # cpus below.
  27. engine = "vllm"
  28. docker_image = "ghcr.io/coolbho3k/deepseek-v4.1-flash-exl3-3bpw-2x-dgx-spark:20260917-rc2"
  29. model = ""
  30. name = "DeepSeek-V4.1-Flash EXL3 3bpw (2x Spark, TP2/DCP2, DSpark K=3, 1M)"
  31. required_nodes = 2
  32. cluster = "8nodes-switch"
  33. tensor_parallel_size = 2
  34. pipeline_parallel_size = 1
  35. distributed_backend = "mp"
  36. shm_size = "2g"
  37. devices = ["/dev/dri/card0"]
  38. memory_limit = "9g"
  39. cpus = 6
  40. extra_mounts_manifest = "/tmp/sm121-staging-exl3-manifests.txt"
  41. # /model + /draft-exl3 are the exact mounts the runtime validates.
  42. entrypoint = [
  43. "/opt/ds41-venv/bin/python",
  44. "/opt/ds41-serving/serve.py",
  45. "serve",
  46. "/model",
  47. "--config",
  48. "/opt/ds41-serving/conservative.yaml",
  49. "--worker-cls",
  50. "combined_worker.CombinedWorker",
  51. "--disable-custom-all-reduce",
  52. ]
  53. args = [
  54. "--served-model-name",
  55. "deepseek-v41-flash-exl3",
  56. "--enable-auto-tool-choice",
  57. "--tool-call-parser",
  58. "deepseek_v41",
  59. "--reasoning-parser",
  60. "deepseek_v41",
  61. ]
  62. before_serve = [
  63. { script = "unlock_display_ram" },
  64. # The runtime kit (serve.py + conservative.yaml + overlay .so + AOT gemm)
  65. # is NOT in the image — it is the pinned release/runtime tree, staged once
  66. # per node and bind-mounted as overlays (serving/ -> /opt/ds41-serving,
  67. # aot/... -> flashinfer AOT dir). One-time git clone at the pinned commit.
  68. "mkdir -p /home/kilork/exl3-cache",
  69. "sudo rm -rf /home/kilork/exl3-cache/ds41-backend-attestation /home/kilork/exl3-cache/ds41-combined-ready /home/kilork/exl3-cache/ds41-display-kv",
  70. "if [ ! -f /home/kilork/exl3-kit/878e0ee/serving/serve.py ]; then rm -rf /home/kilork/exl3-kit/.src-878e0ee /home/kilork/exl3-kit/878e0ee && git clone --quiet https://github.com/coolbho3k/DeepSeek-v4.1-Flash-2x-DGX-Spark.git /home/kilork/exl3-kit/.src-878e0ee && (cd /home/kilork/exl3-kit/.src-878e0ee && git checkout --quiet 878e0eecd893fadc69ad2d58b2df0fabb0fae2ee) && mv /home/kilork/exl3-kit/.src-878e0ee/release/runtime /home/kilork/exl3-kit/878e0ee && rm -rf /home/kilork/exl3-kit/.src-878e0ee; fi && test -f /home/kilork/exl3-kit/878e0ee/serving/serve.py",
  71. ]
  72. after_stop = [{ script = "restore_display_ram", on_failure = "warn" }]
  73. # Hub dir (both repos + hub-level blobs/): the repo blobs/ is itself a layer
  74. # of relative symlinks into the sibling hub-level blobs/<xx>/<sha>, so the
  75. # whole hub tree must be in scope for the chain to resolve.
  76. [[extra_mounts]]
  77. host = "/mnt/nas/ai/huggingface/hub"
  78. container = "/hub"
  79. read_only = true
  80. # /model and /draft-exl3: the runtime opens shard files with O_NOFOLLOW
  81. # (symlink final component => ELOOP), so the container must see regular
  82. # files only. The [[staging]] export materializes them node-locally
  83. # (hardlinks onto the mirror blobs); entries the mirror deliberately does
  84. # not hold (the page15 engram table) arrive as per-file NAS binds via the
  85. # export manifest (extra_mounts_manifest).
  86. # Staging (declarative, specs/tech-architecture/staging-feature.md): the
  87. # hub-mirror adopts the node-local copy the manual staging created (the
  88. # 2026-09-26 mirror at /home/kilork/hf-local) — verification accepts
  89. # untracked matching files into the ledger. First serve verifies only.
  90. [[staging]]
  91. kind = "hub-mirror"
  92. id = "exl3"
  93. dst = "/home/kilork/hf-local"
  94. repos = [
  95. "models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw",
  96. "models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw",
  97. ]
  98. skip = ["engram-page15-v1"]
  99. min_free = "50G"
  100. export = [
  101. "model:models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw:/model",
  102. "draft:models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw:/draft-exl3",
  103. ]
  104. # /model and /draft-exl3: regular-file views of the staged export trees
  105. # (hardlinks onto mirror blobs). read_only = true is REQUIRED: the runtime
  106. # guards weight shards against a writable filesystem. The skipped page15
  107. # table arrives as per-file binds from the export manifest onto mountpoint
  108. # placeholders that staging creates inside the export trees.
  109. [[extra_mounts]]
  110. host = "/home/kilork/hf-local/model"
  111. container = "/model"
  112. read_only = true
  113. [[extra_mounts]]
  114. host = "/home/kilork/hf-local/draft"
  115. container = "/draft-exl3"
  116. read_only = true
  117. # Runtime kit overlays (pinned 878e0ee): the image's /opt/ds41-serving is
  118. # shadowed by the kit's serving tree; the AOT gemm dir is bind-mounted ro.
  119. [[extra_mounts]]
  120. host = "/home/kilork/exl3-kit/878e0ee/serving"
  121. container = "/opt/ds41-serving"
  122. read_only = true
  123. [[extra_mounts]]
  124. host = "/home/kilork/exl3-kit/878e0ee/aot/mxfp8_gemm_cutlass_sm120"
  125. container = "/usr/local/lib/python3.12/dist-packages/flashinfer/data/aot/mxfp8_gemm_cutlass_sm120"
  126. read_only = true
  127. # Node-local runtime cache (triton/tilelang/torch-ext/cuda flashinfer workspaces).
  128. [[extra_mounts]]
  129. host = "/home/kilork/exl3-cache"
  130. container = "/cache"
  131. [env]
  132. # DS41 runtime profile (validated against DS41_* envs; kv_cap_mib is
  133. # env-only, not a CLI flag).
  134. DS41_GPU_MEMORY_UTILIZATION = "0.92"
  135. DS41_MAX_MODEL_LEN = "1048576"
  136. DS41_MAX_NUM_SEQS = "2"
  137. DS41_MAX_NUM_BATCHED_TOKENS = "3072"
  138. DS41_LONG_PREFILL_TOKEN_THRESHOLD = "2816"
  139. DS41_KV_CAP_MIB = "0" # display-only candidate: all KV from the 2 GB display pool
  140. # Feature gates (serve.py hard-requires the '1' set; defaults are 1, set
  141. # explicitly so the guard passes).
  142. DS41_ENABLE_COOPERATIVE_MOE = "1"
  143. DS41_ENABLE_DCP2 = "1"
  144. DS41_ENABLE_DSPARK = "1"
  145. DS41_ENABLE_SSD_VOCAB = "1"
  146. DS41_SSD_ENGRAM_SOURCE = "/model/engrams"
  147. DS41_ENGRAM_CACHE_MIB = "64"
  148. DS41_DRAFT_EXL3_PATH = "/draft-exl3"
  149. # Node-local cache directories (/cache mount, persistent between serves).
  150. VLLM_CACHE_ROOT = "/cache/vllm"
  151. TILELANG_CACHE_DIR = "/cache/tilelang"
  152. TRITON_CACHE_DIR = "/cache/triton"
  153. TORCH_EXTENSIONS_DIR = "/cache/torch-extensions"
  154. CUDA_CACHE_PATH = "/cache/cuda"
  155. XDG_CACHE_HOME = "/cache"
  156. FLASHINFER_WORKSPACE_BASE = "/cache/flashinfer"
  157. TMPDIR = "/cache/tmp"
  158. # Engine / offline / threading.
  159. VLLM_PLUGINS = "ds41"
  160. VLLM_USE_V2_MODEL_RUNNER = "1"
  161. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  162. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  163. VLLM_WORKER_MULTIPROC_METHOD = "spawn"
  164. VLLM_NO_USAGE_STATS = "1"
  165. HF_HUB_OFFLINE = "1"
  166. TRANSFORMERS_OFFLINE = "1"
  167. DSV41_IO_THREADS = "96"
  168. TORCH_CUDA_ARCH_LIST = "12.1a"
  169. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  170. MAX_JOBS = "1"
  171. MKL_NUM_THREADS = "4"
  172. OPENBLAS_NUM_THREADS = "4"
  173. TORCH_NCCL_ASYNC_ERROR_HANDLING = "1"
  174. MALLOC_ARENA_MAX = "2"
  175. MALLOC_TRIM_THRESHOLD_ = "131072"
  176. VLLM_SPARSE_INDEXER_MAX_LOGITS_MB = "128"
  177. # NCCL pins (on top of the launcher's cluster NCCL env).
  178. NCCL_NVLS_ENABLE = "0"
  179. NCCL_CROSS_NIC = "0"
  180. NCCL_IB_MERGE_NICS = "0"
  181. NCCL_CUMEM_ENABLE = "0"
  182. NCCL_MAX_CTAS = "8"
  183. NCCL_BUFFSIZE = "1048576"
  184. NCCL_LL128_BUFFSIZE = "262144"
  185. NCCL_PROTO = "^LL128"
  186. NCCL_MAX_NCHANNELS = "8"
  187. NCCL_IB_ROCE_VERSION_NUM = "2"