x
This commit is contained in:
+5
-7
@@ -267,11 +267,11 @@ RUN set -ex && \
|
||||
echo "vllm C++ build complete (layer cached)."
|
||||
|
||||
# ===========================================================================
|
||||
# 阶段 7.5:复制辅助脚本(必须在所有使用脚本的 RUN 之前)
|
||||
# 阶段 7.5:复制入口 + 辅助脚本
|
||||
# ===========================================================================
|
||||
COPY scripts/patch_vllm_platform.py /opt/patch_vllm_platform.py
|
||||
COPY scripts/apply_mineru_patches.py /opt/apply_mineru_patches.py
|
||||
COPY scripts/cache_warmer.py /opt/cache_warmer.py
|
||||
COPY scripts/entrypoint.sh /opt/entrypoint.sh
|
||||
RUN chmod +x /opt/entrypoint.sh
|
||||
COPY scripts/cache_warmer.py /opt/scripts/cache_warmer.py
|
||||
|
||||
# ===========================================================================
|
||||
# 阶段 8b:安装 vllm + 平台补丁 + 验证
|
||||
@@ -279,7 +279,6 @@ COPY scripts/cache_warmer.py /opt/cache_warmer.py
|
||||
RUN set -ex && \
|
||||
cd /opt/vllm && ${VENV}/bin/pip install -e . --no-build-isolation && \
|
||||
${VENV}/bin/pip install regex && \
|
||||
${VENV}/bin/python /opt/patch_vllm_platform.py && \
|
||||
${VENV}/bin/python -c "import torch; v=torch.__version__; assert 'rocm' in v, f'PyTorch overwritten: {v}'; print('PyTorch OK:', v)" && \
|
||||
${VENV}/bin/pip uninstall -y triton triton-rocm 2>/dev/null; \
|
||||
${VENV}/bin/pip install --force-reinstall \
|
||||
@@ -293,7 +292,6 @@ RUN set -ex && \
|
||||
# ===========================================================================
|
||||
RUN set -ex && \
|
||||
${VENV}/bin/pip install 'mineru[core]' && \
|
||||
${VENV}/bin/python /opt/apply_mineru_patches.py && \
|
||||
# mineru[core] 会把 ROCm PyTorch 替换成 CUDA 版 + 安装 CUDA triton
|
||||
# 必须先卸载 CUDA triton,再装回 ROCm 版
|
||||
${VENV}/bin/pip uninstall -y triton triton-rocm 2>/dev/null; \
|
||||
@@ -310,5 +308,5 @@ RUN set -ex && \
|
||||
RUN echo 'source /opt/mineru_venv/bin/activate' >> /etc/bash.bashrc && \
|
||||
${VENV}/bin/python -c "import torch; import vllm; import mineru; print('MinerU ROCm Docker Image Ready'); print(f'PyTorch {torch.__version__} OK')"
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-c"]
|
||||
ENTRYPOINT ["/opt/entrypoint.sh"]
|
||||
CMD ["bash"]
|
||||
|
||||
@@ -23,6 +23,7 @@ services:
|
||||
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||||
- ./scripts:/opt/scripts:ro
|
||||
command:
|
||||
[
|
||||
"mineru-gradio",
|
||||
@@ -64,6 +65,7 @@ services:
|
||||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||||
- ${MIOPEN_CACHE:-./data/miopen}:/root/.cache/miopen
|
||||
- ./scripts:/opt/scripts:ro
|
||||
command: ["mineru-api", "--host", "0.0.0.0", "--port", "8001"]
|
||||
|
||||
worker1:
|
||||
@@ -89,6 +91,7 @@ services:
|
||||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||||
- ${MODEL_DIR:-./data/models}:/opt/models
|
||||
- ${MIOPEN_CACHE:-./data/miopen}:/root/.cache/miopen
|
||||
- ./scripts:/opt/scripts:ro
|
||||
command: ["mineru-api", "--host", "0.0.0.0", "--port", "8002"]
|
||||
|
||||
router:
|
||||
@@ -104,6 +107,7 @@ services:
|
||||
volumes:
|
||||
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||||
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||||
- ./scripts:/opt/scripts:ro
|
||||
command:
|
||||
[
|
||||
"mineru-router",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# MinerU ROCm 统一入口 — 启动时执行补丁,然后启动指定服务
|
||||
# =============================================================================
|
||||
set -e
|
||||
|
||||
VENV=/opt/mineru_venv
|
||||
SCRIPTS_DIR=/opt/scripts
|
||||
|
||||
echo "[entrypoint] running patches..."
|
||||
|
||||
# vllm 平台补丁
|
||||
if [ -f ${SCRIPTS_DIR}/patch_vllm_platform.py ]; then
|
||||
${VENV}/bin/python ${SCRIPTS_DIR}/patch_vllm_platform.py || echo "[entrypoint] patch_vllm_platform.py failed (non-fatal)"
|
||||
fi
|
||||
|
||||
# MinerU 推理补丁
|
||||
if [ -f ${SCRIPTS_DIR}/apply_mineru_patches.py ]; then
|
||||
${VENV}/bin/python ${SCRIPTS_DIR}/apply_mineru_patches.py || echo "[entrypoint] apply_mineru_patches.py failed (non-fatal)"
|
||||
fi
|
||||
|
||||
echo "[entrypoint] starting: $*"
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user