This commit is contained in:
hailin 2025-07-26 16:42:47 +08:00
parent f0e15aa1d8
commit b70297ece1
1 changed files with 12 additions and 4 deletions

View File

@ -89,8 +89,14 @@ WORKDIR /sgl/sglang/python
RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \
python3 -m pip wheel ".[srt,openai]" --no-deps -w /tmp/sg_wheels
# ── sgl-kernel 的 Python 模块 ───────────────────────────────
RUN pip download --only-binary=:all: --no-deps sgl-kernel -d /tmp/sgl_kernel_wheel
# ── 🔄 编译 sgl-kernel与 sglang 同步)───────────────────────────────────────
# 如果你固定了 sglang 标签,比如 0.4.8.post1则把 REF 也锁到对应 tag / commit
ARG SGL_KERNEL_REF=v0.1.9 # 可换成 v0.2.7 等
WORKDIR /opt
RUN git clone --depth 1 -b ${SGL_KERNEL_REF} https://github.com/sgl-project/sgl-kernel.git
WORKDIR /opt/sgl-kernel/python
RUN python3 -m pip wheel . --no-deps -w /tmp/sgl_kernel_wheels
# ── 收集所有 wheel 到 /wheels ──────────────────────────────────────────────
RUN mkdir -p /wheels && \
@ -99,6 +105,7 @@ RUN mkdir -p /wheels && \
cp /opt/flashinfer/dist/flashinfer_python-*.whl /wheels/ && \
cp /tmp/vllm_wheels/vllm-*.whl /wheels/ && \
cp /tmp/sg_wheels/sglang-*.whl /wheels/ && \
cp /tmp/sgl_kernel_wheels/sgl_kernel-*.whl /wheels/ && \
pip wheel filelock typing-extensions sympy fsspec jinja2 networkx -w /wheels
# ── ✅ 再打包 runtime 阶段必需依赖 ────────────────────────────────────────────
@ -134,7 +141,7 @@ COPY --from=builder-extras /usr/local/cuda/lib64/libcupti.so /usr/lib/x86_64-lin
RUN ldconfig
COPY --from=builder-extras /wheels /tmp/wheels
COPY --from=builder-extras /tmp/sgl_kernel_wheel /tmp/sgl_kernel_wheel
#COPY --from=builder-extras /tmp/sgl_kernel_wheel /tmp/sgl_kernel_wheel
#RUN python3 -m pip install --no-cache-dir /tmp/wheels/* && rm -rf /tmp/wheels
# ✅ 优先装你自编的 torch避免被 PyPI 上的覆盖
@ -143,7 +150,8 @@ RUN ls -lh /tmp/wheels && \
rm -f /tmp/wheels/huggingface_hub-0.33.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/sgl_kernel_wheel/*.whl && \
#python3 -m pip install --no-cache-dir --no-deps /tmp/sgl_kernel_wheel/*.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/* && \
python3 -c "from torch.distributed import Backend; print('✅ Runtime torch distributed OK, GLOO =', Backend.GLOO)" && \
rm -rf /tmp/wheels