x
This commit is contained in:
+20
-9
@@ -294,27 +294,38 @@ COPY scripts/cache_warmer.py /opt/scripts/cache_warmer.py
|
||||
# ===========================================================================
|
||||
RUN set -ex && \
|
||||
export http_proxy=${GIT_PROXY} https_proxy=${GIT_PROXY} && \
|
||||
# 1) 准备 vllm editable 安装所需构建工具(--no-build-isolation 必须预装)
|
||||
# 1) 安装构建工具(后续 pip install 需要)
|
||||
${VENV}/bin/pip install -U "setuptools>=77.0.3" setuptools_scm setuptools_rust wheel && \
|
||||
# 2) 注册 vllm 源码包,不让 pip 解析 torch 依赖
|
||||
# 2) 手动注册 vllm 为 editable package(阶段 8a 已编译 C++ 扩展,此处不触发 cmake)
|
||||
cd /opt/vllm && \
|
||||
${VENV}/bin/pip install -e . --no-build-isolation --no-deps && \
|
||||
# 2) 安装 ROCm PyTorch(后续依赖解析用 ROCm 源补齐 triton-rocm)
|
||||
mkdir -p vllm.egg-info && \
|
||||
cat > vllm.egg-info/PKG-INFO << 'VLLM_EOF' && \
|
||||
Metadata-Version: 2.1
|
||||
Name: vllm
|
||||
Version: 0.0.0
|
||||
Summary: A high-throughput and memory-efficient inference and serving engine for LLMs
|
||||
VLLM_EOF
|
||||
echo "vllm" > vllm.egg-info/top_level.txt && \
|
||||
touch vllm.egg-info/dependency_links.txt && \
|
||||
touch vllm.egg-info/requires.txt && \
|
||||
find vllm -name "*.py" -type f 2>/dev/null | sort > vllm.egg-info/SOURCES.txt && \
|
||||
echo "vllm egg-info created (cmake build skipped, C++ extensions from stage 8a)" && \
|
||||
# 3) 安装 ROCm PyTorch(后续依赖解析用 ROCm 源补齐 triton-rocm)
|
||||
(${VENV}/bin/pip uninstall -y triton triton-rocm 2>/dev/null || true) && \
|
||||
${VENV}/bin/pip install --force-reinstall \
|
||||
torch==2.11.0+rocm7.2 torchvision pytorch-triton-rocm \
|
||||
--index-url ${TORCH_INDEX} && \
|
||||
${VENV}/bin/python -c "import torch; v=torch.__version__; assert 'rocm' in v, f'PyTorch overwritten: {v}'; print('PyTorch OK:', v)" && \
|
||||
# 3) 安装 vllm 运行时依赖;额外加入 ROCm PyTorch 源,避免传递依赖解析 triton-rocm 失败
|
||||
# 4) 安装 vllm 运行时依赖;额外加入 ROCm PyTorch 源,避免传递依赖解析 triton-rocm 失败
|
||||
grep -vE '^(torch|torchvision|torchaudio|triton|triton-rocm|pytorch-triton|setuptools)' requirements/common.txt > /tmp/vllm_deps.txt && \
|
||||
${VENV}/bin/pip install -r /tmp/vllm_deps.txt --extra-index-url ${TORCH_INDEX} && \
|
||||
# 4) 再次确认 PyTorch 仍是 ROCm 版
|
||||
# 5) 再次确认 PyTorch 仍是 ROCm 版
|
||||
${VENV}/bin/python -c "import torch; v=torch.__version__; assert 'rocm' in v, f'PyTorch overwritten after vllm deps: {v}'; print('PyTorch still OK:', v)" && \
|
||||
# 5) 深度验证 vllm(确保 AsyncEngineArgs、AsyncLLM 等关键模块可导入,缺包直接构建失败)
|
||||
# 6) 深度验证 vllm(确保 AsyncEngineArgs、AsyncLLM 等关键模块可导入,缺包直接构建失败)
|
||||
${VENV}/bin/python -c "from vllm.engine.arg_utils import AsyncEngineArgs; from vllm.v1.engine.async_llm import AsyncLLM; print('vllm deep import OK:', __import__('vllm').__version__)" && \
|
||||
# 6) 确保 mineru-api 子进程不依赖 PYTHONPATH 也能导入 vllm
|
||||
# 7) 确保 mineru-api 子进程不依赖 PYTHONPATH 也能导入 vllm
|
||||
echo "/opt/vllm" > ${VENV}/lib/python${PYTHON_VER}/site-packages/vllm.pth && \
|
||||
# 7) 锁定 ROCm 关键包版本(不含 setuptools,避免与 vllm/mineru 依赖冲突)
|
||||
# 8) 锁定 ROCm 关键包版本(不含 setuptools,避免与 vllm/mineru 依赖冲突)
|
||||
${VENV}/bin/pip freeze | grep -iE "^(torch|vllm|triton|pytorch.triton|torchvision|flash.attn|aiter)" >> ${VENV}/torch-constraint.txt && \
|
||||
rm -rf /opt/vllm_build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user