This commit is contained in:
2026-06-05 11:14:53 +08:00
parent 805acbf0a1
commit 270faac7b7
4 changed files with 215 additions and 20 deletions
+13 -18
View File
@@ -144,39 +144,34 @@ RUN if [ -d /opt/rocm/share/amd_smi ]; then \
fi
# ===========================================================================
# 阶段 7:amd-aiter + flash_attn
# 阶段 7:amd-aiter + flash_attn(宿主机预克隆,COPY 进镜像)
# ===========================================================================
# 构建前请先在宿主机 docker/ 目录下克隆:
# git clone --depth 1 --recursive https://github.com/ROCm/aiter.git
# git clone --depth 1 https://github.com/Dao-AILab/flash-attention.git
# cd flash-attention && git checkout bba578d43974c1d3ba157ab597124dd0fe2ccdb4
# git submodule update --init --depth 1 && cd ..
# ===========================================================================
COPY aiter/ /opt/aiter/
COPY flash-attention/ /opt/flash-attention/
RUN set -ex && \
# git 通过代理访问 GitHub
git config --global http.proxy ${GIT_PROXY} && \
git config --global https.proxy ${GIT_PROXY} && \
git config --global http.version HTTP/1.1 && \
git config --global http.postBuffer 524288000 && \
# aiter(AMD 优化的 attention 算子)
cd /opt && git clone --recursive --depth 1 https://github.com/ROCm/aiter.git && \
${VENV}/bin/pip install --no-cache-dir -e /opt/aiter && \
# flash_attn(Triton AMD 后端,锁定已验证的 commit)
cd /opt && git clone --recursive https://github.com/Dao-AILab/flash-attention.git && \
cd flash-attention && git checkout bba578d43974c1d3ba157ab597124dd0fe2ccdb4 && \
${VENV}/bin/pip install --no-cache-dir --no-build-isolation -e /opt/flash-attention && \
# 验证 PyTorch 没被覆盖
${VENV}/bin/python -c "import torch; v=torch.__version__; assert 'rocm' in v, f'PyTorch overwritten: {v}'; print('PyTorch OK:', v)"
# ===========================================================================
# 阶段 8a:编译 vllm(git clone + cmake + ninja,最耗时,单独一层缓存)
# 阶段 8a:编译 vllm(宿主机预克隆 + COPY,cmake + ninja,最耗时,单独一层缓存)
# 构建前请在宿主机 docker/ 目录下克隆:
# git clone --depth 1 https://github.com/vllm-project/vllm.git
# ===========================================================================
COPY vllm/ /opt/vllm/
RUN set -ex && \
# git 通过代理访问 GitHub(国内不通)
git config --global http.proxy ${GIT_PROXY} && \
git config --global https.proxy ${GIT_PROXY} && \
# 代理下大仓库容易断,改用 HTTP/1.1 + 加大 buffer
git config --global http.version HTTP/1.1 && \
git config --global http.postBuffer 524288000 && \
# setuptools 升级(PEP 639 兼容)
${VENV}/bin/pip install --no-cache-dir -U \
"setuptools>=77.0.3" setuptools_scm setuptools_rust wheel && \
# 克隆 vllm main
cd /opt && git clone --depth 1 https://github.com/vllm-project/vllm.git && \
# 补丁 5:注释掉 vllm mamba 模块的 operator+ 定义(可能已被 vllm 移除)
cd /opt/vllm && \
if [ -f csrc/mamba/mamba_ssm/selective_scan.h ]; then \