recipe.toml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # DeepSeek-V4-Flash-Vision-Exp — vavrusa sparkrun lane ported to the launcher.
  2. #
  3. # Working OpenAI image_url multimodal serving on DGX Spark from
  4. # vavrusa/sparkrun-recipes `deepseek-v4-flash-vision-exp-eugr.yaml`
  5. # (ghcr.io/spark-arena/dgx-vllm-eugr-nightly-b12x:20260810 + two runtime
  6. # mods). This is the eugr A/B lane (todo #26) AND the image_url lane for
  7. # the vision checkpoint — compare against recipes/dsv4-flash-vision
  8. # (our plugin on dsv4-flash-vision:local).
  9. #
  10. # Mod provenance (vendored verbatim under mods/):
  11. # * instanttensor-hybrid-draft-loader — keeps InstantTensor for the target
  12. # while embedded-MTP drafts load via lazy safetensors.
  13. # * deepseek-v4-vision-exp — stages vision_exp + injects a fail-closed
  14. # import hook (port of MiaAI-Lab/DeepSeek-v4-Flash-DSpark-2x-DGX-Spark)
  15. # into the Anemll fork's deepseek_v4/nvidia/model.py: ViT + aligner,
  16. # weight mapping for vision./aligner./image_*/bias_vl, vLLM multimodal
  17. # processor registration, embed_input_ids embedding scatter, DSpark
  18. # draft ffn.gate.bias_vl remap.
  19. #
  20. # Checkpoint deltas vs text-only 0731 (from their README): vision keys;
  21. # num_nextn_predict_layers 1→3 (DSpark k must be a multiple of 3 → k=6);
  22. # rms_norm_eps 1e-6→1e-20 (mod overrides back to 1e-6 for the fused Gram
  23. # mHC kernel); ffn.gate +bias_vl (loaded, not applied at routing).
  24. # Images go in USER messages only; ≤384 image tokens per image.
  25. #
  26. # DEVIATIONS from the sparkrun recipe — all forced by our launcher:
  27. # * no --host/--port (launcher fabric), TP size from recipe math,
  28. # * --served-model-name pinned to our quant-agnostic lane alias
  29. # `deepseek-v4-flash-vision` (HF_HUB_OFFLINE makes a bare label carry
  30. # the cache path otherwise),
  31. # * default-chat-template-kwargs thinking=false / effort=low to match the
  32. # tool-eval c1 lane (their recipe ships thinking=true / high),
  33. # * weights from per-node local NVMe copies (`~/dsv4vision-hf` on
  34. # dgx3/dgx4, 167.8 GiB each). Fallback: swap the extra_mounts block to
  35. # /mnt/nas/ai/huggingface (see recipes/dsv4-flash-vision).
  36. engine = "vllm"
  37. # eugr nightly image carries no ENTRYPOINT — required by the mods contract.
  38. entrypoint = ["vllm", "serve"]
  39. name = "DeepSeek V4 Flash Vision-Exp (eugr nightly + vavrusa vision mods)"
  40. docker_image = "ghcr.io/spark-arena/dgx-vllm-eugr-nightly-b12x:20260810"
  41. model = "deepseek-ai/DeepSeek-V4-Flash-Vision-Exp"
  42. required_nodes = 2
  43. tensor_parallel_size = 2
  44. pipeline_parallel_size = 1
  45. distributed_backend = "mp"
  46. shm_size = "32gb"
  47. args = [
  48. "--served-model-name", "deepseek-v4-flash-vision",
  49. "--trust-remote-code",
  50. "--tensor-parallel-size", "2",
  51. "--kv-cache-dtype", "fp8_ds_mla",
  52. # their picks: max-model-len auto (KV pool revalidated after first
  53. # launch — the vision tower replicates per rank), 5 seqs / 4096 tokens.
  54. "--max-model-len", "auto",
  55. "--max-num-seqs", "5",
  56. "--max-num-batched-tokens", "4096",
  57. "--gpu-memory-utilization", "0.82",
  58. "--block-size", "256",
  59. "--enable-prefix-caching",
  60. "--enable-chunked-prefill",
  61. "--enable-prompt-tokens-details",
  62. "--enable-flashinfer-autotune",
  63. "--async-scheduling",
  64. "--tokenizer-mode", "deepseek_v4",
  65. "--tool-call-parser", "deepseek_v4",
  66. "--enable-auto-tool-choice",
  67. "--reasoning-parser", "deepseek_v4",
  68. "--reasoning-config", """
  69. '{"reasoning_parser":"deepseek_v4","reasoning_start_str":"","reasoning_end_str":""}'""",
  70. "--default-chat-template-kwargs", """
  71. '{"thinking":false,"reasoning_effort":"low"}'""",
  72. "--override-generation-config", """
  73. '{"temperature":1.0,"top_p":0.95}'""",
  74. "--limit-mm-per-prompt", """
  75. '{"image":8}'""",
  76. "--load-format", "instanttensor",
  77. "--moe-backend", "b12x",
  78. "--linear-backend", "b12x",
  79. "--attention-backend", "B12X_MLA_SPARSE",
  80. "--max-cudagraph-capture-size", "64",
  81. "--compilation-config", """
  82. '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}'""",
  83. # num_nextn_predict_layers=3 → k multiple of 3; k=6 (smallest ≥ dspark
  84. # block size 5). Do NOT drop back to 5.
  85. "--speculative-config", """
  86. '{"method":"dspark","num_speculative_tokens":6,"draft_sample_method":"greedy","attention_backend":"B12X_MLA_SPARSE"}'""",
  87. ]
  88. [env]
  89. PYTHONHASHSEED = "0"
  90. CUTE_DSL_ARCH = "sm_121a"
  91. VLLM_USE_AOT_COMPILE = "1"
  92. VLLM_USE_BREAKABLE_CUDAGRAPH = "0"
  93. VLLM_USE_MEGA_AOT_ARTIFACT = "-1"
  94. VLLM_MEMORY_PROFILE_INCLUDE_ATTN = "1"
  95. VLLM_USE_FLASHINFER_SAMPLER = "1"
  96. VLLM_USE_B12X_WO_PROJECTION = "1"
  97. VLLM_USE_B12X_MHC = "1"
  98. VLLM_USE_B12X_FP8_GEMM = "1"
  99. VLLM_USE_B12X_MOE = "1"
  100. VLLM_USE_B12X_SPARSE_INDEXER = "1"
  101. VLLM_MOE_SKIP_PADDING = "0"
  102. VLLM_USE_V2_MODEL_RUNNER = "1"
  103. B12X_MLA_SM120_UNIFIED = "1"
  104. B12X_MOE_FORCE_A8 = "1"
  105. VLLM_PREFIX_CACHE_RETENTION_INTERVAL = "4096"
  106. HF_HUB_OFFLINE = "1"
  107. TRANSFORMERS_OFFLINE = "1"
  108. VLLM_NO_USAGE_STATS = "1"
  109. # Weights from per-node local NVMe copies; JIT caches persist per node.
  110. # NOTE: extra_mounts stay AFTER args (TOML table headers would swallow the
  111. # args array otherwise).
  112. [[extra_mounts]]
  113. host = "~/dsv4vision-hf"
  114. container = "/opt/local-hf"
  115. env = "HF_HOME"
  116. # Both mods run inside the container before exec'ing vllm serve. The
  117. # vision mod stages to /opt/dspark-patches and rewrites site-packages —
  118. # the container fs stays writable (only /mods is :ro).
  119. [[mods.commands]]
  120. command = "bash /mods/instanttensor-hybrid-draft-loader/run.sh"
  121. [[mods.commands]]
  122. command = "bash /mods/deepseek-v4-vision-exp/run.sh"