部署MinerU

1、拉取镜像:‣

# Use DaoCloud mirrored vllm image for China region for gpu with Ampere architecture and above (Compute Capability>=8.0)
# Compute Capability version query (<https://developer.nvidia.com/cuda-gpus>)
FROM docker.m.daocloud.io/vllm/vllm-openai:v0.10.1.1

# 替换APT源为国内镜像(解决源签名和网络访问问题)
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
    sed -i 's|http://security.ubuntu.com/ubuntu/|https://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
    apt-get clean

# 安装字体和依赖
RUN apt-get update && \
    apt-get install -y \
        fonts-noto-core \
        fonts-noto-cjk \
        fontconfig \
        libgl1 && \
    fc-cache -fv && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# 安装 mineru
RUN python3 -m pip install -U 'mineru[core]' -i <https://mirrors.aliyun.com/pypi/simple> --break-system-packages && \
    python3 -m pip cache purge

# 下载模型
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"

ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

2、构建镜像:docker build -t mineru-vllm:latest -f Dockerfile .

sudo docker build -t harbor-cmp.zoomlion.com/library/mineru:v2.6.3 -f Dockerfile .

使用vllm加速VLM模型推理需要满足的条件是:

3、打包成/bin/sh

构建命令:docker build -t harbor-cmp.zoomlion.com/library/mineru:v2.6.3-sh .

FROM harbor-cmp.zoomlion.com/library/mineru:v2.6.3
ENTRYPOINT ["/bin/sh", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

4、模型下载

modelscope download --model opendatalab/MinerU2.5-2509-1.2B --local_dir /data/models/MinerU2.5-2509-1.2B

5、启动服务

mineru-vllm-server --model /data/modelRepository/mineru/mineru_2025114165604 --served-model-name MinerU2.5-2509-1.2B --host 0.0.0.0 --port 8080 ~~--api-key fe21b93dd0234e64a8ab44d4c49cf365 --chat-template-content-format /data/modelRepository/mineru/mineru_2025114165604/chat_template.json~~