From b70297ece12b9d2a06827488289f601d0e2e25ad Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 26 Jul 2025 16:42:47 +0800 Subject: [PATCH] . --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e88440..2322d16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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