Dockerfile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # GLM-5.2 Int4-Int8Mix overlay on sparkrun-vllm-ds4-gb10:glm52
  2. #
  3. # Unsets VLLM_PREFIX_CACHE_RETENTION_INTERVAL (baked at 4096 in the base
  4. # deepseek image, breaks GLM-5.2) via a wrapper that sources the original
  5. # nvidia_entrypoint.sh first, then hands off with exec after the unset.
  6. #
  7. # Build:
  8. # cd docker-images/glm52 && bash build.sh
  9. # Tags: sparkrun-vllm-ds4-gb10:glm52
  10. FROM aidendle94/sparkrun-vllm-ds4-gb10:production-hybrid-1.4
  11. # 1.4 patches quantization/__init__.py to `from . import hybrid_modelopt_ct`
  12. # but never ships hybrid_modelopt_ct.py — a build bug in the base image that
  13. # breaks all vLLM imports with a circular-import error. Remove the dangling
  14. # import; no recipe uses hybrid_modelopt_ct (all use hybrid_mxfp4_ct).
  15. RUN sed -i '/from . import hybrid_modelopt_ct/d' \
  16. /opt/venv/lib/python3.12/site-packages/vllm/model_executor/layers/quantization/__init__.py
  17. # Patch vLLM structured-output reasoning-boundary bug under speculative
  18. # decoding (MTP). When the reasoning parser emits the reasoning-end marker
  19. # () under MTP, the grammar FSM (used by response_format / guided decoding)
  20. # failed to advance, so the content channel was unconstrained — models
  21. # emitted prose or markdown-fence prefixes before JSON (tool-eval-bench
  22. # Structured Output: 50% instead of 100%).
  23. #
  24. # Ports upstream vLLM PRs:
  25. # #44297 — Constrain bitmask and trim grammar advance at the boundary
  26. # #44993 — Advance grammar across reasoning boundary (fixes #34650,
  27. # #43388, #48228)
  28. #
  29. # Changes: should_advance() accepts new_token_ids (authoritative step delta),
  30. # records reasoning_end_token_index, returns True for all constraint types;
  31. # scheduler trims reasoning content before accept_tokens; grammar_bitmask
  32. # constrains draft tokens after the marker mid-window.
  33. COPY patch-structured-output.py /tmp/patch-structured-output.py
  34. RUN python3 /tmp/patch-structured-output.py && rm /tmp/patch-structured-output.py
  35. RUN pip install --no-cache-dir --no-deps --force-reinstall nvidia-nccl-cu13==2.30.4 \
  36. && pip install --no-cache-dir --no-deps --force-reinstall instanttensor==0.1.9
  37. # Wrapper: unset the baked var, then hand off to the original entrypoint.
  38. # The original nvidia_entrypoint.sh does `exec "$@"` at the end, so this
  39. # runs as PID 1 with conda/CUDA paths sourced and the baked var gone.
  40. RUN printf '#!/bin/bash\nunset VLLM_PREFIX_CACHE_RETENTION_INTERVAL\nexec /opt/nvidia/nvidia_entrypoint.sh "$@"\n' > /entrypoint-wrapper.sh && chmod +x /entrypoint-wrapper.sh
  41. ENTRYPOINT ["/entrypoint-wrapper.sh"]