gen-locks.sh 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env bash
  2. # Regenerate the hash-locked python requirements for the DS4 from-source build.
  3. #
  4. # The checked-in python locks detached from the GLM-5.2 NF3-Hybrid harness are
  5. # NOT valid here: they pin torch 2.11 / flashinfer 0.6.12. This stack (the
  6. # newest local-inference-lab b12x fork, feat/gg-ds4-0731-launcher) uses
  7. # torch 2.12.0, flashinfer 0.6.15, cutlass-dsl 4.6.0 — so we lock from the
  8. # FORK'S OWN requirements/* at the pinned commit, which are authoritative.
  9. #
  10. # Usage (run on the aarch64 build host, e.g. dgx3.lan, before build.sh):
  11. # bash gen-locks.sh
  12. # Writes locks/python-build.txt and locks/python-runtime.txt.
  13. #
  14. # Requires: uv (bootstrapped in the Dockerfile's apt-base; or `apt install uv`).
  15. set -euo pipefail
  16. cd "$(dirname "$0")"
  17. source ./versions.env
  18. PY="${PYTHON_VERSION:-3.12}"
  19. PLAT="${PLATFORM:-aarch64-unknown-linux-gnu}"
  20. W="${VLLM_WORKSPACE:-$PWD/.gen/vllm}" # shallow fork checkout (partial clone)
  21. echo "==> ensuring fork checkout at ${VLLM_COMMIT}"
  22. if [[ ! -d "$W/.git" ]]; then
  23. mkdir -p "$(dirname "$W")"
  24. git clone --filter=blob:none --no-checkout "${VLLM_REPO}" "$W"
  25. fi
  26. git -C "$W" fetch --depth 1 origin "${VLLM_COMMIT}"
  27. git -C "$W" checkout --detach "${VLLM_COMMIT}"
  28. common_flags=(--generate-hashes --python-version "$PY" --python-platform "$PLAT"
  29. --index-url "$PYPI_INDEX_URL" --extra-index-url "$PYTORCH_INDEX_URL"
  30. --index-strategy unsafe-best-match)
  31. echo "==> python-build.txt (vLLM build deps, torch 2.12.0)"
  32. mkdir -p .gen
  33. # Also install the CUDA-side build companions the source builds need at build
  34. # time (tvm_ffi is required by flashinfer-cubin's backend; torch/compiler deps
  35. # come from the fork's own build/*.txt).
  36. printf -- "-r '${W}/requirements/build/cuda.txt'\n-r '${W}/requirements/build/rust.txt'\napache-tvm-ffi==${TVM_FFI_VERSION}\nnvidia-nvshmem-cu13==${NVSHMEM_VERSION}\nnvidia-ml-py\nnvidia-cudnn-frontend\nnvidia-cudnn-cu13\npillow\nprotobuf\ntqdm\nregex\nrequests\npyproject-hooks\nwheel\nsemantic-version\nvcs-versioning\nsetuptools-scm\n" > .gen/build.in
  37. uv pip compile "${common_flags[@]}" .gen/build.in \
  38. --output-file locks/python-build.txt
  39. echo "==> python-runtime.txt (vLLM CUDA runtime deps)"
  40. # FlashInfer is built from source and installed as a wheel (see Dockerfile), so
  41. # drop the flashinfer lines (and the flashinfer.ai extra-index directive) from
  42. # the lock — otherwise the runner's install can't resolve flashinfer-cubin and
  43. # the pinned 0.6.14 would also collide with our built 0.6.15 wheel.
  44. sed -e '/flashinfer/I d' -e '/extra-index-url.*flashinfer[^ ]*/I d' \
  45. "$W/requirements/cuda.txt" \
  46. | sed "s|^-r common.txt|-r ${W}/requirements/common.txt|" > .gen/runtime.in
  47. # FlashInfer is stripped from the lock above (we build 0.6.15 from source and
  48. # install the wheel with --no-deps in the Dockerfile), so uv never sees its
  49. # install_requires. Re-add its hard transitive deps explicitly so `pip check`
  50. # passes: the runner installs them from this lock. cuda-tile/nccl4py resolve
  51. # to cp312 aarch64 wheels (deep-gemm / vllm-flash-attn / ray are not required
  52. # by the fork's vLLM and have no aarch64 build, so they stay out).
  53. cat >> .gen/runtime.in <<'EOF'
  54. # --- FlashInfer 0.6.15 transitive deps (built from source, installed --no-deps) ---
  55. cuda-tile==1.5.0
  56. nccl4py==0.3.1
  57. EOF
  58. uv pip compile "${common_flags[@]}" .gen/runtime.in \
  59. --output-file locks/python-runtime.txt
  60. echo "locked. Now: cd docker-images/deepseek-v4-flash-dspark-src && bash build.sh"