This commit is contained in:
hailin 2025-09-20 10:43:14 +08:00
parent 57d862d695
commit b9b1969610
1 changed files with 10 additions and 2 deletions

View File

@ -57,9 +57,17 @@ 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 --no-deps
find /tmp/torch_dist -name 'torch-*.whl' -print | xargs -r python3 -m pip install --no-cache-dir --no-deps && \
# 立刻补齐 torch 运行时依赖(重点!)
python3 -m pip install --no-cache-dir \
"typing-extensions>=4.10.0" "sympy>=1.13.3" jinja2 fsspec networkx filelock
RUN python3 - <<'PY'
import torch, typing_extensions, sympy, jinja2, fsspec, networkx
print("✅ Torch:", torch.__version__)
PY
# ── 编译 torchvision 0.22.1 (依赖本地 torch) ────────────────────────────────
WORKDIR /opt
RUN git clone -b v0.22.1 https://github.com/pytorch/vision.git
@ -77,7 +85,7 @@ WORKDIR /opt/flashinfer
ENV FLASHINFER_CUDA_ARCH_LIST="7.5 8.0 8.6 8.9"
# 先做 AOT 预编译,再直接打 wheel不隔离使用同一份自编 torch
RUN python3 -m pip install --no-cache-dir numpy requests build "cuda-python>=12.0,<13" "nvidia-nvshmem-cu12" ninja pynvml filelock && \
RUN python3 -m pip install --no-cache-dir numpy requests build "cuda-python>=12.0,<13" "nvidia-nvshmem-cu12" ninja pynvml && \
python3 -m flashinfer.aot && \
python3 -m build --no-isolation --wheel && \
ls -lh dist/