This commit is contained in:
hailin 2025-09-21 13:33:00 +08:00
parent ae99d6a643
commit 89e7e9d337
1 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,5 @@
###############################################################################
# Stage 0 ─ builder-torch编译 PyTorch 2.7.1 (+cu126)
# Stage 0 ─ builder-torch编译 PyTorch 2.8.0 (+cu126)
###############################################################################
ARG CUDA_VERSION=12.6.1
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04 AS builder-torch
@ -38,6 +38,7 @@ COPY ./pytorch_2.8.0/ /opt/pytorch
WORKDIR /opt/pytorch
ENV MAX_JOBS=${MAX_JOBS}
RUN echo "Building PyTorch with USE_DISTRIBUTED=$USE_DISTRIBUTED" && \
export PYTORCH_BUILD_VERSION=2.8.0 PYTORCH_BUILD_NUMBER=1 && \
python3 setup.py bdist_wheel
###############################################################################
@ -141,7 +142,7 @@ RUN python3 -m pip install --no-cache-dir "cmake>=3.27,<4.0" scikit-build-core==
'
# ★ 构建期 constraints把自编的 torch / sgl-kernel / flashinfer 都锁到本地 wheel
# ★ 构constraints把自编的 torchsgl-kernelflashinfer都锁到本地 wheel用于接下来的sglang 0.5.2打wheel
RUN bash -lc '\
set -euo pipefail; \
TWHL=$(ls /tmp/torch_dist/torch-*.whl | head -n1); \
@ -156,6 +157,7 @@ RUN bash -lc '\
echo ">>> build-time constraints:"; cat /tmp/local_constraints_build.txt \
'
#安装刚构建好的sgl_kernel到当前正在构建的docker image中
RUN python3 -m pip install --no-cache-dir --no-deps /tmp/sgl_kernel_wheels/sgl_kernel-*.whl
@ -230,7 +232,6 @@ COPY _wheelhouse/ /tmp/wheels/
# 安装顺序与 runtime-autobuild 完全一致(优先 torch再装其它
RUN ls -lh /tmp/wheels || true && \
# rm -f /tmp/wheels/torch-2.7.1a0+*.whl && \
rm -f /tmp/wheels/huggingface_hub-0.34.4*.whl || true && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/torch*.whl && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/vllm-*.whl || true && \
@ -276,13 +277,11 @@ COPY _wheelhouse/ /tmp/wheels/
# ✅ 优先装你自编的 torch避免被 PyPI 上的覆盖
RUN ls -lh /tmp/wheels && \
# rm -f /tmp/wheels/torch-2.7.1a0+*.whl && \
rm -f /tmp/wheels/huggingface_hub-0.34.4*.whl && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/torch*.whl && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/vllm-*.whl && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/sgl_kernel-*.whl && \
python3 -m pip install --no-cache-dir --no-deps /tmp/wheels/gradio-5.38.2*.whl && \
# python3 -m pip install --no-cache-dir --no-deps $(ls /tmp/wheels | grep -v '^gradio-' | sed 's|^|/tmp/wheels/|') && \
python3 -m pip install --no-cache-dir --no-deps $(find /tmp/wheels -maxdepth 1 -type f -name '*.whl' ! -name 'gradio-*') && \
python3 -c "import gradio, sys; print('✅ Gradio version =', gradio.__version__)" && \
rm -rf /tmp/wheels