2026-09-26_155026_exl3-2x-first.recipe.toml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. extra_mounts_manifest = "/tmp/sm121-exl3-mounts.txt"
  37. # /model + /draft-exl3 are the exact mounts the runtime validates.
  38. entrypoint = [
  39. "/opt/ds41-venv/bin/python",
  40. "/opt/ds41-serving/serve.py",
  41. "serve",
  42. "/model",
  43. "--config",
  44. "/opt/ds41-serving/conservative.yaml",
  45. "--worker-cls",
  46. "combined_worker.CombinedWorker",
  47. "--disable-custom-all-reduce",
  48. ]
  49. args = [
  50. "--served-model-name",
  51. "deepseek-v41-flash-exl3",
  52. "--enable-auto-tool-choice",
  53. "--tool-call-parser",
  54. "deepseek_v41",
  55. "--reasoning-parser",
  56. "deepseek_v41",
  57. ]
  58. before_serve = [
  59. { script = "unlock_display_ram" },
  60. # Model + drafter staging: the hub snapshot's internal relative symlinks
  61. # (../../../blobs/…) only resolve at the real hub depth. The full repo dir
  62. # (blobs/ + snapshots/) is mounted at /hub, and the staging dir at /model
  63. # holds RELATIVE symlinks (../hub/...) into it — the kernel lands on the
  64. # real correct-depth tree and the inner links resolve.
  65. "python3 - models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw $(cat /mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-EXL3-3bpw/refs/main) /model models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw $(cat /mnt/nas/ai/huggingface/hub/models--coolbho3k--DeepSeek-V4.1-Flash-DSpark-EXL3-3bpw/refs/main) /draft-exl3 <<'GENSTAGE'\nimport os, sys\nHUB = '/mnt/nas/ai/huggingface/hub'\nMANIFEST = '/tmp/sm121-exl3-mounts.txt'\ndef gen(repo, rev, out):\n snap = os.path.join(HUB, repo, 'snapshots', rev)\n lines = []\n for name in sorted(os.listdir(snap)):\n src = os.path.join(snap, name)\n real = os.path.realpath(src)\n if os.path.isdir(real):\n for root, _, files in os.walk(real):\n for fn in sorted(files):\n fp = os.path.join(root, fn)\n freal = os.path.realpath(fp)\n sub = os.path.relpath(fp, real)\n lines.append(freal + '\\t' + os.path.join(out, name, sub))\n else:\n lines.append(real + '\\t' + os.path.join(out, name))\n with open(MANIFEST, 'a') as f:\n f.write('\\n'.join(lines) + '\\n')\n print('manifest', MANIFEST, len(lines), 'mounts for', out, flush=True)\nrepo, rev, out, drepo, drev, dout = sys.argv[1:7]\nopen(MANIFEST, 'w').close() # truncate once before both gens\ngen(repo, rev, out)\ngen(drepo, drev, dout)\nGENSTAGE",
  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. # Hub dir (both repos + hub-level blobs/): the repo blobs/ is itself a layer
  75. # of relative symlinks into the sibling hub-level blobs/<xx>/<sha>, so the
  76. # whole hub tree must be in scope for the chain to resolve.
  77. [[extra_mounts]]
  78. host = "/mnt/nas/ai/huggingface/hub"
  79. container = "/hub"
  80. read_only = true
  81. # /model and /draft-exl3 are NOT dir-mounted: the runtime opens the shard
  82. # files with O_NOFOLLOW (symlink final component => ELOOP), so the
  83. # before-serve hook generates a per-file bind manifest instead
  84. # (extra_mounts_manifest) — the container sees regular files only.
  85. # Runtime kit overlays (pinned 878e0ee): the image's /opt/ds41-serving is
  86. # shadowed by the kit's serving tree; the AOT gemm dir is bind-mounted ro.
  87. [[extra_mounts]]
  88. host = "/home/kilork/exl3-kit/878e0ee/serving"
  89. container = "/opt/ds41-serving"
  90. read_only = true
  91. [[extra_mounts]]
  92. host = "/home/kilork/exl3-kit/878e0ee/aot/mxfp8_gemm_cutlass_sm120"
  93. container = "/usr/local/lib/python3.12/dist-packages/flashinfer/data/aot/mxfp8_gemm_cutlass_sm120"
  94. read_only = true
  95. # Node-local runtime cache (triton/tilelang/torch-ext/cuda flashinfer workspaces).
  96. [[extra_mounts]]
  97. host = "/home/kilork/exl3-cache"
  98. container = "/cache"
  99. [env]
  100. # DS41 runtime profile (validated against DS41_* envs; kv_cap_mib is
  101. # env-only, not a CLI flag).
  102. DS41_GPU_MEMORY_UTILIZATION = "0.92"
  103. DS41_MAX_MODEL_LEN = "1048576"
  104. DS41_MAX_NUM_SEQS = "2"
  105. DS41_MAX_NUM_BATCHED_TOKENS = "3072"
  106. DS41_LONG_PREFILL_TOKEN_THRESHOLD = "2816"
  107. DS41_KV_CAP_MIB = "0" # display-only candidate: all KV from the 2 GB display pool
  108. # Feature gates (serve.py hard-requires the '1' set; defaults are 1, set
  109. # explicitly so the guard passes).
  110. DS41_ENABLE_COOPERATIVE_MOE = "1"
  111. DS41_ENABLE_DCP2 = "1"
  112. DS41_ENABLE_DSPARK = "1"
  113. DS41_ENABLE_SSD_VOCAB = "1"
  114. DS41_SSD_ENGRAM_SOURCE = "/model/engrams"
  115. DS41_ENGRAM_CACHE_MIB = "64"
  116. DS41_DRAFT_EXL3_PATH = "/draft-exl3"
  117. # Node-local cache directories (/cache mount, persistent between serves).
  118. VLLM_CACHE_ROOT = "/cache/vllm"
  119. TILELANG_CACHE_DIR = "/cache/tilelang"
  120. TRITON_CACHE_DIR = "/cache/triton"
  121. TORCH_EXTENSIONS_DIR = "/cache/torch-extensions"
  122. CUDA_CACHE_PATH = "/cache/cuda"
  123. XDG_CACHE_HOME = "/cache"
  124. FLASHINFER_WORKSPACE_BASE = "/cache/flashinfer"
  125. TMPDIR = "/cache/tmp"
  126. # Engine / offline / threading.
  127. VLLM_PLUGINS = "ds41"
  128. VLLM_USE_V2_MODEL_RUNNER = "1"
  129. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  130. VLLM_ENGINE_READY_TIMEOUT_S = "3600"
  131. VLLM_WORKER_MULTIPROC_METHOD = "spawn"
  132. VLLM_NO_USAGE_STATS = "1"
  133. HF_HUB_OFFLINE = "1"
  134. TRANSFORMERS_OFFLINE = "1"
  135. DSV41_IO_THREADS = "96"
  136. TORCH_CUDA_ARCH_LIST = "12.1a"
  137. FLASHINFER_CUDA_ARCH_LIST = "12.1a"
  138. MAX_JOBS = "1"
  139. MKL_NUM_THREADS = "4"
  140. OPENBLAS_NUM_THREADS = "4"
  141. TORCH_NCCL_ASYNC_ERROR_HANDLING = "1"
  142. MALLOC_ARENA_MAX = "2"
  143. MALLOC_TRIM_THRESHOLD_ = "131072"
  144. VLLM_SPARSE_INDEXER_MAX_LOGITS_MB = "128"
  145. # NCCL pins (on top of the launcher's cluster NCCL env).
  146. NCCL_NVLS_ENABLE = "0"
  147. NCCL_CROSS_NIC = "0"
  148. NCCL_IB_MERGE_NICS = "0"
  149. NCCL_CUMEM_ENABLE = "0"
  150. NCCL_MAX_CTAS = "8"
  151. NCCL_BUFFSIZE = "1048576"
  152. NCCL_LL128_BUFFSIZE = "262144"
  153. NCCL_PROTO = "^LL128"
  154. NCCL_MAX_NCHANNELS = "8"
  155. NCCL_IB_ROCE_VERSION_NUM = "2"