Procházet zdrojové kódy

deepseek-v4-flash: Aiden base 3.75 + encoder fix baked in, 1M ctx, match 0rand compose tuning

Follow-up on NVIDIA forum thread 372268/708 (0rand's DS4F-DSpark serving
stack). Align recipe + image with its proven values:
- Dockerfile: FROM production-3.75 (was 3.7 in a tmp commit), re-enable the
  deepseek_v4 encoder patch COPY (three-level low/high/max ladder).
- max-model-len 524288 -> 1M
- max-num-batched-tokens 16536 -> 16384, max-cudagraph-capture-size 16 -> 512
- add --override-generation-config {temp 0.8, top_p 0.25, rep_penalty 1.0}
- reasoning_effort high -> max, thinking -> enable_thinking
- env: add NCCL_NVLS_ENABLE=0 (rest of NCCL comes from cluster config)
Alexander Korolev před 2 měsíci
rodič
revize
42032fbe12

+ 11 - 6
docker-images/deepseek-v4-flash-dspark/Dockerfile

@@ -4,13 +4,14 @@
 #
 # production-3.75 already ships the patched NCCL 2.30.4 ABI (its base layers
 # are byte-identical to production-3.2, which is labeled "patched NCCL
-# 2.30.4"), so no NCCL re-alignment is needed. This overlay only adds
-# instanttensor for faster model loading (load-format instanttensor).
+# 2.30.4"), so no NCCL re-alignment is needed. This overlay adds instanttensor
+# for faster model loading (load-format instanttensor) plus the deepseek_v4
+# encoder reasoning-effort fix (see patch COPY below).
 #
 # Build: cd docker-images/deepseek-v4-flash-dspark && docker build -t sparkrun-vllm-ds4-gb10:fixed .
 # Tag:   docker tag sparkrun-vllm-ds4-gb10:fixed aidendle94/sparkrun-vllm-ds4-gb10:production-3.75
 
-FROM aidendle94/sparkrun-vllm-ds4-gb10:production-3.7
+FROM aidendle94/sparkrun-vllm-ds4-gb10:production-3.75
 
 RUN pip install --no-cache-dir --no-deps --force-reinstall instanttensor==0.1.9
 
@@ -24,6 +25,10 @@ RUN pip install --no-cache-dir --no-deps --force-reinstall instanttensor==0.1.9
 # prompt dict, correct gate for both high and max, and reasoning_content key.
 # deepseek_v4.py carries the normalization fix so low is reachable and unknown
 # values map to None. See deepseek_v4.py / deepseek_v4_encoding.py in patches/.
-#COPY patches/deepseek_v4.py \
-#     patches/deepseek_v4_encoding.py \
-#     /opt/venv/lib/python3.12/site-packages/vllm/tokenizers/
+# Mirrors the encoder fix 0rand bundled into his local
+# production-3.75-reffix-0731 image (forums…/372268/708): we keep it as a
+# source overlay on our own :fixed image instead of adopting the private
+# -reffix tag.
+COPY patches/deepseek_v4.py \
+     patches/deepseek_v4_encoding.py \
+     /opt/venv/lib/python3.12/site-packages/vllm/tokenizers/

+ 19 - 7
recipes/deepseek-v4-flash/recipe.toml

@@ -20,6 +20,9 @@
 #
 # Reference: Nvidia Developer Forum — DeepSeek-V4-Flash-0731 recipe
 #   https://forums.developer.nvidia.com/t/deepseek-v4-flash-0731-dspark-1m-nvfp4-kv-2x-dgx-spark/378824
+# Encoder reasoning-effort fix source: 0rand's serving stack (thread 372268/708)
+#   https://forums.developer.nvidia.com/t/deepseek-v4-flash-aiden-recipe-from-reddit-1m-token-session-operational-cuda-12-1-tailored-for-dgx-spark-gb10/372268/708
+#   (three-level low/high/max ladder; bundled into the :fixed overlay here)
 
 engine = "vllm"
 name = "DeepSeek V4 Flash DSpark (vLLM)"
@@ -38,10 +41,10 @@ args = [
     "--kv-cache-dtype", "fp8",
     "--block-size", "256",
     "--load-format", "auto",
-    "--max-model-len", "524288",
+    "--max-model-len", "1048576",
     "--max-num-seqs", "16",
-    "--max-num-batched-tokens", "16536",
-    "--max-cudagraph-capture-size", "16",
+    "--max-num-batched-tokens", "16384",
+    "--max-cudagraph-capture-size", "512",
     "--gpu-memory-utilization", "0.84",
     "--served-model-name", "deepseek-v4-flash",
     # Engine backends
@@ -68,11 +71,15 @@ args = [
     "--tool-call-parser", "deepseek_v4",
     "--reasoning-parser", "deepseek_v4",
     "--enable-auto-tool-choice",
+    # Proven generation defaults (thread 372268/708 serving stack; with
+    # --generation-config vllm only the override params are applied, so these
+    # set the served defaults). repetition_penalty 1.0 = identity: the field is
+    # accepted by the spec but never deviates from no-op during req handling.
+    "--override-generation-config", """
+'{"temperature":0.8,"top_p":0.25,"repetition_penalty":1.0}'""",
     "--generation-config", "vllm",
-    "--default-chat-template-kwargs.thinking=true",
-    "--default-chat-template-kwargs.reasoning_effort=high",
-#    "--default-chat-template-kwargs.temperature=1",
-#    "--default-chat-template-kwargs.top_p=1",
+    "--default-chat-template-kwargs.enable_thinking=true",
+    "--default-chat-template-kwargs.reasoning_effort=max",
     # Disable custom all-reduce (not needed on GB10 single-NIC)
     "--disable-custom-all-reduce",
     "--trust-remote-code",
@@ -124,8 +131,13 @@ HF_HUB_OFFLINE = "1"
 TORCH_CUDA_ARCH_LIST = "12.1a"
 
 # NCCL overrides (cluster config ib_hca/socket_ifname used for most; recipe wins last)
+# NCCL_CROSS_NIC / NCCL_PROTO come from the cluster [nccl] section (2nodes-dac:
+# cross_nic=0, proto=LL,LL128,Simple) — matches the reference compose except
+# cross_nic (reference runs 1; our cluster config deliberately uses 0 for this
+# single-RoCE topology). NCCL_NVLS_ENABLE mirrors the reference compose.
 NCCL_P2P_LEVEL = "SYS"
 NCCL_CUMEM_ENABLE = "0"
+NCCL_NVLS_ENABLE = "0"
 NCCL_IB_TIMEOUT = "24"
 NCCL_IB_QPS_PER_CONNECTION = "8"
 NCCL_BUFFERSIZE = "16777216"