recipe.toml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 live on the shared NAS (hub layout); the launch
  16. # nodes symlink the current refs/main snapshot and bind it at /model (the
  17. # runtime hard-requires the model at exactly /model) and the drafter overlay
  18. # at /draft-exl3.
  19. #
  20. # Cgroup: the runtime's serving guard hard-requires a 9 GiB / no-swap /
  21. # <=6-CPU cgroup (memory.max==9g, swap 0, cpu quota <=6) — memory_limit +
  22. # cpus below.
  23. engine = "vllm"
  24. docker_image = "ghcr.io/coolbho3k/deepseek-v4.1-flash-exl3-3bpw-2x-dgx-spark:20260917-rc2"
  25. model = ""
  26. name = "DeepSeek-V4.1-Flash EXL3 3bpw (2x Spark, TP2/DCP2, DSpark K=3, 1M)"
  27. required_nodes = 2
  28. cluster = "8nodes-switch"
  29. tensor_parallel_size = 2
  30. pipeline_parallel_size = 1
  31. distributed_backend = "mp"
  32. shm_size = "2g"
  33. devices = ["/dev/dri/card0"]
  34. memory_limit = "9g"
  35. cpus = 6
  36. # /model + /draft-exl3 are the exact mounts the runtime validates.
  37. entrypoint = [
  38. "/opt/ds41-venv/bin/python",
  39. "/opt/ds41-serving/serve.py",
  40. "serve",
  41. "/model",
  42. "--config",
  43. "/opt/ds41-serving/conservative.yaml",
  44. "--worker-cls",
  45. "combined_worker.CombinedWorker",
  46. "--disable-custom-all-reduce",
  47. ]
  48. args = [
  49. "--served-model-name",
  50. "deepseek-v41-flash-exl3",
  51. "--enable-auto-tool-choice",
  52. "--tool-call-parser",
  53. "deepseek_v41",
  54. "--reasoning-parser",
  55. "deepseek_v41",
  56. ]
  57. before_serve = [
  58. { script = "unlock_display_ram" },
  59. # Model + drafter staging: the hub snapshot's internal relative symlinks
  60. # (../../../blobs/…) only resolve at the real hub depth. The full repo dir
  61. # (blobs/ + snapshots/) is mounted at /hub, and the staging dir at /model
  62. # holds RELATIVE symlinks (../hub/...) into it — the kernel lands on the
  63. # real correct-depth tree and the inner links resolve.
  64. "REPO=/mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw && REV=$(cat $REPO/refs/main) && rm -rf /home/kilork/exl3-model && mkdir -p /home/kilork/exl3-model && for f in $REPO/snapshots/$REV/*; do ln -s \"../hub/snapshots/$REV/$(basename $f)\" /home/kilork/exl3-model/$(basename $f); done",
  65. "DREPO=/mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw && DREV=$(cat $DREPO/refs/main) && rm -rf /home/kilork/exl3-draft && mkdir -p /home/kilork/exl3-draft && for f in $DREPO/snapshots/$DREV/*; do ln -s \"../dh-draft/snapshots/$DREV/$(basename $f)\" /home/kilork/exl3-draft/$(basename $f); done",
  66. # The runtime kit (serve.py + conservative.yaml + overlay .so + AOT gemm)
  67. # is NOT in the image — it is the pinned release/runtime tree, staged once
  68. # per node and bind-mounted as overlays (serving/ -> /opt/ds41-serving,
  69. # aot/... -> flashinfer AOT dir). One-time git clone at the pinned commit.
  70. "mkdir -p /home/kilork/exl3-cache",
  71. "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",
  72. ]
  73. after_stop = [{ script = "restore_display_ram", on_failure = "warn" }]
  74. # Repo dirs (blobs/ + snapshots/) — the real tree the staging symlinks land
  75. # in; the internal ../../../blobs links resolve here at full depth.
  76. [[extra_mounts]]
  77. host = "/mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw"
  78. container = "/hub"
  79. read_only = true
  80. [[extra_mounts]]
  81. host = "/mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw"
  82. container = "/dh-draft"
  83. read_only = true
  84. # Staging dirs (relative symlinks into /hub and /dh-draft).
  85. [[extra_mounts]]
  86. host = "/home/kilork/exl3-model"
  87. container = "/model"
  88. read_only = true
  89. [[extra_mounts]]
  90. host = "/home/kilork/exl3-draft"
  91. container = "/draft-exl3"
  92. read_only = true
  93. # Runtime kit overlays (pinned 878e0ee): the image's /opt/ds41-serving is
  94. # shadowed by the kit's serving tree; the AOT gemm dir is bind-mounted ro.
  95. [[extra_mounts]]
  96. host = "/home/kilork/exl3-kit/878e0ee/serving"
  97. container = "/opt/ds41-serving"
  98. read_only = true
  99. [[extra_mounts]]
  100. host = "/home/kilork/exl3-kit/878e0ee/aot/mxfp8_gemm_cutlass_sm120"
  101. container = "/usr/local/lib/python3.12/dist-packages/flashinfer/data/aot/mxfp8_gemm_cutlass_sm120"
  102. read_only = true
  103. # Node-local runtime cache (triton/tilelang/torch-ext/cuda flashinfer workspaces).
  104. [[extra_mounts]]
  105. host = "/home/kilork/exl3-cache"
  106. container = "/cache"
  107. [env]
  108. # DS41 runtime profile (validated against DS41_* envs; kv_cap_mib is
  109. # env-only, not a CLI flag).
  110. DS41_GPU_MEMORY_UTILIZATION = "0.92"
  111. DS41_MAX_MODEL_LEN = "1048576"
  112. DS41_MAX_NUM_SEQS = "2"
  113. DS41_MAX_NUM_BATCHED_TOKENS = "3072"
  114. DS41_LONG_PREFILL_TOKEN_THRESHOLD = "2816"
  115. DS41_KV_CAP_MIB = "0" # display-only candidate: all KV from the 2 GB display pool
  116. # Feature gates (serve.py hard-requires the '1' set; defaults are 1, set
  117. # explicitly so the guard passes).
  118. DS41_ENABLE_COOPERATIVE_MOE = "1"
  119. DS41_ENABLE_DCP2 = "1"
  120. DS41_ENABLE_DSPARK = "1"
  121. DS41_ENABLE_SSD_VOCAB = "1"
  122. DS41_SSD_ENGRAM_SOURCE = "/model/engrams"
  123. DS41_ENGRAM_CACHE_MIB = "64"
  124. DS41_DRAFT_EXL3_PATH = "/draft-exl3"
  125. # Node-local cache directories (/cache mount, persistent between serves).
  126. VLLM_CACHE_ROOT = "/cache/vllm"
  127. TILELANG_CACHE_DIR = "/cache/tilelang"
  128. TRITON_CACHE_DIR = "/cache/triton"
  129. TORCH_EXTENSIONS_DIR = "/cache/torch-extensions"
  130. CUDA_CACHE_PATH = "/cache/cuda"
  131. XDG_CACHE_HOME = "/cache"
  132. FLASHINFER_WORKSPACE_BASE = "/cache/flashinfer"
  133. TMPDIR = "/cache/tmp"
  134. # Engine / offline / threading.
  135. VLLM_PLUGINS = "ds41"
  136. VLLM_USE_V2_MODEL_RUNNER = "1"
  137. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  138. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  139. VLLM_WORKER_MULTIPROC_METHOD = "spawn"
  140. VLLM_NO_USAGE_STATS = "1"
  141. HF_HUB_OFFLINE = "1"
  142. TRANSFORMERS_OFFLINE = "1"
  143. DSV41_IO_THREADS = "96"
  144. TORCH_CUDA_ARCH_LIST = "12.1a"
  145. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  146. MAX_JOBS = "1"
  147. MKL_NUM_THREADS = "4"
  148. OPENBLAS_NUM_THREADS = "4"
  149. TORCH_NCCL_ASYNC_ERROR_HANDLING = "1"
  150. MALLOC_ARENA_MAX = "2"
  151. MALLOC_TRIM_THRESHOLD_ = "131072"
  152. VLLM_SPARSE_INDEXER_MAX_LOGITS_MB = "128"
  153. # NCCL pins (on top of the launcher's cluster NCCL env).
  154. NCCL_NVLS_ENABLE = "0"
  155. NCCL_CROSS_NIC = "0"
  156. NCCL_IB_MERGE_NICS = "0"
  157. NCCL_CUMEM_ENABLE = "0"
  158. NCCL_MAX_CTAS = "8"
  159. NCCL_BUFFSIZE = "1048576"
  160. NCCL_LL128_BUFFSIZE = "262144"
  161. NCCL_PROTO = "^LL128"
  162. NCCL_MAX_NCHANNELS = "8"
  163. NCCL_IB_ROCE_VERSION_NUM = "2"