This commit is contained in:
parent
bc8452f783
commit
57e01ee012
32
Dockerfile
32
Dockerfile
|
|
@ -57,7 +57,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
COPY --from=builder-torch /opt/pytorch/dist /tmp/torch_dist
|
||||
RUN set -e && \
|
||||
echo "==> Files in /tmp/torch_dist:" && ls -lh /tmp/torch_dist && \
|
||||
find /tmp/torch_dist -name 'torch-*.whl' -print | xargs -r python3 -m pip install --no-cache-dir
|
||||
find /tmp/torch_dist -name 'torch-*.whl' -print | xargs -r python3 -m pip install --no-cache-dir --no-deps
|
||||
|
||||
|
||||
# ── 编译 torchvision 0.22.1 (依赖本地 torch) ────────────────────────────────
|
||||
|
|
@ -103,7 +103,6 @@ RUN bash -lc '\
|
|||
/usr/local/cuda/bin/ptxas --version \
|
||||
'
|
||||
|
||||
|
||||
# 限制构建并行;避免 ptxas 多线程崩溃
|
||||
ENV CMAKE_BUILD_PARALLEL_LEVEL=8
|
||||
ENV SGL_KERNEL_COMPILE_THREADS=1
|
||||
|
|
@ -123,12 +122,20 @@ RUN python3 -m pip install --no-cache-dir "cmake>=3.27,<4.0" scikit-build-core==
|
|||
'
|
||||
|
||||
|
||||
# ★ 生成 constraints,强制 sgl-kernel 只能用本地 wheel
|
||||
RUN bash -lc 'set -e; \
|
||||
WHEEL=$(ls /tmp/sgl_kernel_wheels/sgl_kernel-*.whl | head -n1); \
|
||||
echo "sgl-kernel @ file://$WHEEL" > /tmp/sgl_constraints.txt; \
|
||||
echo ">>> Using constraint:"; cat /tmp/sgl_constraints.txt'
|
||||
|
||||
# ★ 构建期 constraints:把自编的 torch / sgl-kernel / flashinfer 都锁到本地 wheel
|
||||
RUN bash -lc '\
|
||||
set -euo pipefail; \
|
||||
TWHL=$(ls /tmp/torch_dist/torch-*.whl | head -n1); \
|
||||
SKWHL=$(ls /tmp/sgl_kernel_wheels/sgl_kernel-*.whl | head -n1); \
|
||||
FWHL=$(ls /opt/flashinfer/dist/flashinfer_python-*.whl 2>/dev/null | head -n1 || true); \
|
||||
: > /tmp/local_constraints_build.txt; \
|
||||
echo "torch @ file://$TWHL" >> /tmp/local_constraints_build.txt; \
|
||||
echo "sgl-kernel @ file://$SKWHL" >> /tmp/local_constraints_build.txt; \
|
||||
if [ -n "$FWHL" ]; then \
|
||||
echo "flashinfer-python @ file://$FWHL" >> /tmp/local_constraints_build.txt; \
|
||||
fi; \
|
||||
echo ">>> build-time constraints:"; cat /tmp/local_constraints_build.txt \
|
||||
'
|
||||
|
||||
RUN python3 -m pip install --no-cache-dir --no-deps /tmp/sgl_kernel_wheels/sgl_kernel-*.whl
|
||||
|
||||
|
|
@ -137,15 +144,10 @@ RUN python3 -m pip install --no-cache-dir --no-deps /tmp/sgl_kernel_wheels/sgl_k
|
|||
WORKDIR /opt
|
||||
RUN pip download --only-binary=:all: --no-deps vllm==0.9.1 -d /tmp/vllm_wheels
|
||||
|
||||
|
||||
# ── 编译你本地 sglang 源码并打 wheel ───────────────────────────────────────
|
||||
# COPY ./sglang /sgl/sglang
|
||||
# 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
|
||||
WORKDIR /sgl/sglang/python
|
||||
RUN python3 -m pip install --no-build-isolation -c /tmp/sgl_constraints.txt ".[srt,openai]" && \
|
||||
python3 -m pip wheel --no-build-isolation -c /tmp/sgl_constraints.txt ".[srt,openai]" -w /tmp/sg_wheels
|
||||
RUN python3 -m pip install --no-build-isolation -c /tmp/local_constraints_build.txt ".[srt,openai]" && \
|
||||
python3 -m pip wheel --no-build-isolation -c /tmp/local_constraints_build.txt ".[srt,openai]" -w /tmp/sg_wheels
|
||||
|
||||
|
||||
# ── 收集所有 wheel 到 /wheels ──────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in New Issue