Browse Source

Merge pull request #4062 from myhloli/dev

Adapted for NPU, PPU, and MACA.
Xiaomeng Zhao 3 days ago
parent
commit
700321b23d

+ 8 - 4
README.md

@@ -44,6 +44,9 @@
 </div>
 
 # Changelog
+- 2025/11/26 2.6.5 Release
+  - Added support for a new backend vlm-lmdeploy-engine. Its usage is similar to vlm-vllm-(async)engine, but it uses lmdeploy as the inference engine and additionally supports native inference acceleration on Windows platforms compared to vllm.
+
 - 2025/11/04 2.6.4 Release
   - Added timeout configuration for PDF image rendering, default is 300 seconds, can be configured via environment variable `MINERU_PDF_RENDER_TIMEOUT` to prevent long blocking of the rendering process caused by some abnormal PDF files.
   - Added CPU thread count configuration options for ONNX models, default is the system CPU core count, can be configured via environment variables `MINERU_INTRA_OP_NUM_THREADS` and `MINERU_INTER_OP_NUM_THREADS` to reduce CPU resource contention conflicts in high concurrency scenarios.
@@ -684,7 +687,7 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
         </tr>
         <tr>
             <th>Python Version</th>
-            <td colspan="6" style="text-align:center;">3.10-3.13</td>
+            <td colspan="6" style="text-align:center;">3.10-3.13<sup>7</sup></td>
         </tr>
     </tbody>
 </table>
@@ -694,7 +697,8 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
 <sup>3</sup> MLX requires macOS 13.5 or later, recommended for use with version 14.0 or higher.  
 <sup>4</sup> Windows vLLM support via WSL2(Windows Subsystem for Linux).  
 <sup>5</sup> Windows LMDeploy can only use the `turbomind` backend, which is slightly slower than the `pytorch` backend. If performance is critical, it is recommended to run it via WSL2.  
-<sup>6</sup> Servers compatible with the OpenAI API, such as local or remote model services deployed via inference frameworks like `vLLM`, `SGLang`, or `LMDeploy`.
+<sup>6</sup> Servers compatible with the OpenAI API, such as local or remote model services deployed via inference frameworks like `vLLM`, `SGLang`, or `LMDeploy`.  
+<sup>7</sup> Windows + LMDeploy only supports Python versions 3.10–3.12, as the critical dependency `ray` does not yet support Python 3.13 on Windows.
 
 
 ### Install MinerU
@@ -714,8 +718,8 @@ uv pip install -e .[core]
 ```
 
 > [!TIP]
-> `mineru[core]` includes all core features except `vLLM` acceleration, compatible with Windows / Linux / macOS systems, suitable for most users.
-> If you need to use `vLLM` acceleration for VLM model inference or install a lightweight client on edge devices, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).
+> `mineru[core]` includes all core features except `vLLM`/`LMDeploy` acceleration, compatible with Windows / Linux / macOS systems, suitable for most users.
+> If you need to use `vLLM`/`LMDeploy` acceleration for VLM model inference or install a lightweight client on edge devices, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).
 
 ---
  

+ 12 - 4
README_zh-CN.md

@@ -44,6 +44,13 @@
 </div>
 
 # 更新记录
+
+- 2025/11/26 2.6.5 发布
+  - 增加新后端`vlm-lmdeploy-engine`支持,使用方式与`vlm-vllm-(async)engine`类似,但使用`lmdeploy`作为推理引擎,与`vllm`相比额外支持Windows平台原生推理加速。
+  - 新增国产算力平台`昇腾/npu`、`平头哥/ppu`、`沐曦/maca`的适配支持,用户可在对应平台上使用`pipeline`与`vlm`模型,并使用`vllm`/`lmdeploy`引擎加速vlm模型推理,具体使用方式请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)。
+    - 国产平台适配不易,我们已尽量确保适配的完整性和稳定性,但仍可能存在一些稳定性/兼容问题与精度对齐问题,请大家根据适配文档页面内红绿灯情况自行选择合适的环境与场景进行使用。
+    - 如在使用国产化平台适配方案的过程中遇到任何文档未提及的问题,为便于其他用户查找解决方案,请在discussions的[指定帖子](https://github.com/opendatalab/MinerU/discussions/4053)中进行反馈。
+
 - 2025/11/04 2.6.4 发布
   - 为pdf渲染图片增加超时配置,默认为300秒,可通过环境变量`MINERU_PDF_RENDER_TIMEOUT`进行配置,防止部分异常pdf文件导致渲染过程长时间阻塞。
   - 为onnx模型增加cpu线程数配置选项,默认为系统cpu核心数,可通过环境变量`MINERU_INTRA_OP_NUM_THREADS`和`MINERU_INTER_OP_NUM_THREADS`进行配置,以减少高并发场景下的对cpu资源的抢占冲突。
@@ -671,7 +678,7 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
         </tr>
         <tr>
             <th>python版本</th>
-            <td colspan="6" style="text-align:center;">3.10-3.13</td>
+            <td colspan="6" style="text-align:center;">3.10-3.13<sup>7</sup></td>
         </tr>
     </tbody>
 </table> 
@@ -681,7 +688,8 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
 <sup>3</sup> MLX需macOS 13.5及以上版本支持,推荐14.0以上版本使用  
 <sup>4</sup> Windows vLLM通过WSL2(适用于 Linux 的 Windows 子系统)实现支持  
 <sup>5</sup> Windows LMDeploy只能使用`turbomind`后端,速度比`pytorch`后端稍慢,如对速度有要求建议通过WSL2运行  
-<sup>6</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务
+<sup>6</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务  
+<sup>7</sup> Windows + LMDeploy 由于关键依赖`ray`未能在windows平台支持Python 3.13,故仅支持至3.10~3.12版本
 
 > [!TIP]
 > 除以上主流环境与平台外,我们也收录了一些社区用户反馈的其他平台支持情况,详情请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)。  
@@ -704,8 +712,8 @@ uv pip install -e .[core] -i https://mirrors.aliyun.com/pypi/simple
 ```
 
 > [!TIP]
-> `mineru[core]`包含除`vLLM`加速外的所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
-> 如果您有使用`vLLM`加速VLM模型推理,或是在边缘设备安装轻量版client端等需求,可以参考文档[扩展模块安装指南](https://opendatalab.github.io/MinerU/zh/quick_start/extension_modules/)。
+> `mineru[core]`包含除`vLLM`/`LMDeploy`加速外的所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
+> 如果您需要使用`vLLM`/`LMDeploy`加速VLM模型推理,或是有在边缘设备安装轻量版client端等需求,可以参考文档[扩展模块安装指南](https://opendatalab.github.io/MinerU/zh/quick_start/extension_modules/)。
 
 ---
  

+ 0 - 6
docker/china/Dockerfile

@@ -2,15 +2,9 @@
 # Compute Capability version query (https://developer.nvidia.com/cuda-gpus)
 FROM docker.m.daocloud.io/vllm/vllm-openai:v0.10.1.1
 
-# Use the official vllm image
-# FROM vllm/vllm-openai:v0.10.1.1
-
 # Use DaoCloud mirrored vllm image for China region for gpu with Turing architecture and below (Compute Capability<8.0)
 # FROM docker.m.daocloud.io/vllm/vllm-openai:v0.10.2
 
-# Use the official vllm image
-# FROM vllm/vllm-openai:v0.10.2
-
 # Install libgl for opencv support & Noto fonts for Chinese characters
 RUN apt-get update && \
     apt-get install -y \

+ 0 - 23
docker/china/camb.Dockerfile

@@ -1,23 +0,0 @@
-# Base image containing the LMDeploy inference environment, requiring amd64 CPU + cambricon MLU.
-FROM
-
-# Install libgl for opencv support & Noto fonts for Chinese characters
-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/*
-
-# Install mineru latest
-RUN python3 -m pip install -U 'mineru[core]' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
-    python3 -m pip cache purge
-
-# Download models and update the configuration file
-RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
-
-# Set the entry point to activate the virtual environment and run the command line tool
-ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

+ 16 - 5
docker/china/maca.Dockerfile

@@ -1,5 +1,8 @@
-# Base image containing the LMDeploy inference environment, requiring amd64 CPU + metax GPU.
-FROM
+# 基础镜像配置 vLLM 或 LMDeploy 推理环境,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + metax GPU。
+# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + metax GPU.
+FROM cr.metax-tech.com/public-ai-release/maca/vllm:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-amd64
+# Base image containing the LMDeploy inference environment, requiring amd64(x86-64) CPU + metax GPU.
+# FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/maca:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-lmdeploy0.10.2-amd64
 
 # Install libgl for opencv support & Noto fonts for Chinese characters
 RUN apt-get update && \
@@ -12,12 +15,20 @@ RUN apt-get update && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
+# mod torchvision to be compatible with torch 2.6
+RUN sed -i '3s/^Version: 0.15.1+metax3\.1\.0\.4$/Version: 0.21.0+metax3.1.0.4/' /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info/METADATA && \
+    mv /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info /opt/conda/lib/python3.10/site-packages/torchvision-0.21.0+metax3.1.0.4.dist-info
+
 # Install mineru latest
-RUN python3 -m pip install -U 'mineru[core]' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
-    python3 -m pip cache purge
+RUN /opt/conda/bin/python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
+    /opt/conda/bin/python3 -m pip install 'mineru[core]>=2.6.5' \
+                                           numpy==1.26.4 \
+                                           opencv-python==4.11.0.86 \
+                                           -i https://mirrors.aliyun.com/pypi/simple && \
+    /opt/conda/bin/python3 -m pip cache purge
 
 # Download models and update the configuration file
-RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
+RUN /bin/bash -c "/opt/conda/bin/mineru-models-download -s modelscope -m all"
 
 # Set the entry point to activate the virtual environment and run the command line tool
 ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

+ 11 - 5
docker/china/npu.Dockerfile

@@ -1,5 +1,9 @@
-# Base image containing the LMDeploy inference environment, requiring ARM CPU + Ascend NPU.
-FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ascend:mineru-a2
+# 基础镜像配置 vLLM 或 LMDeploy ,请根据实际需要选择其中一个,要求 ARM(AArch64) CPU + Ascend NPU。
+# Base image containing the vLLM inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
+FROM quay.io/ascend/vllm-ascend:v0.11.0rc1
+# Base image containing the LMDeploy inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
+# FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ascend:mineru-a2
+
 
 # Install libgl for opencv support & Noto fonts for Chinese characters
 RUN apt-get update && \
@@ -7,17 +11,19 @@ RUN apt-get update && \
         fonts-noto-core \
         fonts-noto-cjk \
         fontconfig \
-        libgl1 && \
+        libgl1 \
+        libglib2.0-0 && \
     fc-cache -fv && \
     apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
 # Install mineru latest
-RUN python3 -m pip install -U 'mineru[core]' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
+RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
+    python3 -m pip install -U 'mineru[core]>=2.6.5' -i https://mirrors.aliyun.com/pypi/simple && \
     python3 -m pip cache purge
 
 # Download models and update the configuration file
-RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
+RUN TORCH_DEVICE_BACKEND_AUTOLOAD=0 /bin/bash -c "mineru-models-download -s modelscope -m all"
 
 # Set the entry point to activate the virtual environment and run the command line tool
 ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]

+ 14 - 3
docker/china/ppu.Dockerfile

@@ -1,5 +1,8 @@
-# Base image containing the LMDeploy inference environment, requiring amd64 CPU + t-head PPU.
-FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ppu:mineru-ppu
+# 基础镜像配置 vLLM 或 LMDeploy 推理环境,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + t-head PPU。
+# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + t-head PPU.
+FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/ppu:ppu-pytorch2.6.0-ubuntu24.04-cuda12.6-vllm0.8.5-py312
+# Base image containing the LMDeploy inference environment, requiring amd64(x86-64) CPU + t-head PPU.
+# FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ppu:mineru-ppu
 
 # Install libgl for opencv support & Noto fonts for Chinese characters
 RUN apt-get update && \
@@ -13,7 +16,15 @@ RUN apt-get update && \
     rm -rf /var/lib/apt/lists/*
 
 # Install mineru latest
-RUN python3 -m pip install -U 'mineru[core]' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
+RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
+    python3 -m pip install 'mineru[core]>=2.6.5' \
+                            numpy==1.26.4 \
+                            opencv-python==4.11.0.86 \
+                            huggingface_hub==0.36.0 \
+                            dill==0.3.6 \
+                            setuptools==74.1.1 \
+                            tokenizers==0.21.1 \
+                            -i https://mirrors.aliyun.com/pypi/simple && \
     python3 -m pip cache purge
 
 # Download models and update the configuration file

+ 65 - 49
docker/compose.yaml

@@ -1,19 +1,38 @@
 services:
-  mineru-vllm-server:
+  mineru-openai-server:
     image: mineru:latest
-    container_name: mineru-vllm-server
+    container_name: mineru-openai-server
     restart: always
-    profiles: ["vllm-server"]
+    profiles: ["openai-server"]
     ports:
       - 30000:30000
     environment:
       MINERU_MODEL_SOURCE: local
-    entrypoint: mineru-vllm-server
+    entrypoint: mineru-openai-server
     command:
+      # ==================== Engine Selection ====================
+      # WARNING: Only ONE engine can be enabled at a time!
+      # Choose 'vllm' OR 'lmdeploy' (uncomment one line below)
+      --engine vllm
+      # --engine lmdeploy
+      
+      # ==================== vLLM Engine Parameters ====================
+      # Uncomment if using --engine vllm
       --host 0.0.0.0
       --port 30000
-      # --data-parallel-size 2  # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
-      # --gpu-memory-utilization 0.5  # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
+      # Multi-GPU configuration (increase throughput)
+      # --data-parallel-size 2
+      # Single GPU memory optimization (reduce if VRAM insufficient)
+      # --gpu-memory-utilization 0.5  # Try 0.4 or lower if issues persist
+
+      # ==================== LMDeploy Engine Parameters ====================
+      # Uncomment if using --engine lmdeploy
+      # --server-name 0.0.0.0
+      # --server-port 30000
+      # Multi-GPU configuration (increase throughput)
+      # --dp 2
+      # Single GPU memory optimization (reduce if VRAM insufficient)
+      # --cache-max-entry-count 0.5  # Try 0.4 or lower if issues persist
     ulimits:
       memlock: -1
       stack: 67108864
@@ -25,38 +44,9 @@ services:
         reservations:
           devices:
             - driver: nvidia
-              device_ids: ["0"]
+              device_ids: ["0"]  # Modify for multiple GPUs: ["0", "1"]
               capabilities: [gpu]
 
-  mineru-lmdeploy-server:
-    image: mineru:latest
-    container_name: mineru-lmdeploy-server
-    restart: always
-    profiles: [ "lmdeploy-server" ]
-    ports:
-      - 30000:30000
-    environment:
-      MINERU_MODEL_SOURCE: local
-    entrypoint: mineru-lmdeploy-server
-    command:
-      --host 0.0.0.0
-      --port 30000
-    # --dp 2  # If using multiple GPUs, increase throughput using lmdeploy's multi-GPU parallel mode
-    # --cache-max-entry-count 0.5  # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
-    ulimits:
-      memlock: -1
-      stack: 67108864
-    ipc: host
-    healthcheck:
-      test: [ "CMD-SHELL", "curl -f http://localhost:30000/health || exit 1" ]
-    deploy:
-      resources:
-        reservations:
-          devices:
-            - driver: nvidia
-              device_ids: [ "0" ]
-              capabilities: [ gpu ]
-
   mineru-api:
     image: mineru:latest
     container_name: mineru-api
@@ -68,11 +58,21 @@ services:
       MINERU_MODEL_SOURCE: local
     entrypoint: mineru-api
     command:
+      # ==================== Server Configuration ====================
       --host 0.0.0.0
       --port 8000
-      # parameters for vllm-engine
-      # --data-parallel-size 2  # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
-      # --gpu-memory-utilization 0.5  # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
+
+      # ==================== vLLM Engine Parameters ====================
+      # Multi-GPU configuration
+      # --data-parallel-size 2
+      # Single GPU memory optimization
+      # --gpu-memory-utilization 0.5  # Try 0.4 or lower if VRAM insufficient
+
+      # ==================== LMDeploy Engine Parameters ====================
+      # Multi-GPU configuration
+      # --dp 2
+      # Single GPU memory optimization
+      # --cache-max-entry-count 0.5  # Try 0.4 or lower if VRAM insufficient
     ulimits:
       memlock: -1
       stack: 67108864
@@ -82,8 +82,8 @@ services:
         reservations:
           devices:
             - driver: nvidia
-              device_ids: [ "0" ]
-              capabilities: [ gpu ]
+              device_ids: ["0"]  # Modify for multiple GPUs: ["0", "1"]
+              capabilities: [gpu]
 
   mineru-gradio:
     image: mineru:latest
@@ -96,14 +96,30 @@ services:
       MINERU_MODEL_SOURCE: local
     entrypoint: mineru-gradio
     command:
+      # ==================== Gradio Server Configuration ====================
       --server-name 0.0.0.0
       --server-port 7860
-      --enable-vllm-engine true  # Enable the vllm engine for Gradio
-      # --enable-api false  # If you want to disable the API, set this to false
-      # --max-convert-pages 20  # If you want to limit the number of pages for conversion, set this to a specific number
-      # parameters for vllm-engine
-      # --data-parallel-size 2  # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
-      # --gpu-memory-utilization 0.5  # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
+      
+      # ==================== Gradio Feature Settings ====================
+      # --enable-api false  # Disable API endpoint
+      # --max-convert-pages 20  # Limit conversion page count
+      
+      # ==================== Engine Selection ====================
+      # WARNING: Only ONE engine can be enabled at a time!
+      
+      # Option 1: vLLM Engine (recommended for most users)
+      --enable-vllm-engine true
+      # Multi-GPU configuration
+      # --data-parallel-size 2
+      # Single GPU memory optimization
+      # --gpu-memory-utilization 0.5  # Try 0.4 or lower if VRAM insufficient
+
+      # Option 2: LMDeploy Engine
+      # --enable-lmdeploy-engine true
+      # Multi-GPU configuration
+      # --dp 2
+      # Single GPU memory optimization
+      # --cache-max-entry-count 0.5  # Try 0.4 or lower if VRAM insufficient
     ulimits:
       memlock: -1
       stack: 67108864
@@ -113,5 +129,5 @@ services:
         reservations:
           devices:
             - driver: nvidia
-              device_ids: [ "0" ]
-              capabilities: [ gpu ]
+              device_ids: ["0"]  # Modify for multiple GPUs: ["0", "1"]
+              capabilities: [gpu]

+ 6 - 7
docs/en/quick_start/docker_deployment.md

@@ -20,7 +20,7 @@ MinerU's Docker uses `vllm/vllm-openai` as the base image, so it includes the `v
 > [!NOTE]
 > Requirements for using `vllm` to accelerate VLM model inference:
 > 
-> - Device must have Turing architecture or later graphics cards with 8GB+ available VRAM.
+> - Device must have Volta architecture or later graphics cards with 8GB+ available VRAM.
 > - The host machine's graphics driver should support CUDA 12.8 or higher; You can check the driver version using the `nvidia-smi` command.
 > - Docker container must have access to the host machine's graphics devices.
 
@@ -51,17 +51,17 @@ wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/compose.yaml
 >
 >- The `compose.yaml` file contains configurations for multiple services of MinerU, you can choose to start specific services as needed.
 >- Different services might have additional parameter configurations, which you can view and edit in the `compose.yaml` file.
->- Due to the pre-allocation of GPU memory by the `vllm` inference acceleration framework, you may not be able to run multiple `vllm` services simultaneously on the same machine. Therefore, ensure that other services that might use GPU memory have been stopped before starting the `vlm-vllm-server` service or using the `vlm-vllm-engine` backend.
+>- Due to the pre-allocation of GPU memory by the `vllm` inference acceleration framework, you may not be able to run multiple `vllm` services simultaneously on the same machine. Therefore, ensure that other services that might use GPU memory have been stopped before starting the `vlm-openai-server` service or using the `vlm-vllm-engine` backend.
 
 ---
 
-### Start vllm-server service
-connect to `vllm-server` via `vlm-http-client` backend
+### Start OpenAI-compatible server service
+connect to `openai-server` via `vlm-http-client` backend
   ```bash
-  docker compose -f compose.yaml --profile vllm-server up -d
+  docker compose -f compose.yaml --profile openai-server up -d
   ```
   >[!TIP]
-  >In another terminal, connect to vllm server via http client (only requires CPU and network, no vllm environment needed)
+  >In another terminal, connect to openai server via http client (only requires CPU and network, no vllm environment needed)
   > ```bash
   > mineru -p <input_path> -o <output_path> -b vlm-http-client -u http://<server_ip>:30000
   > ```
@@ -84,4 +84,3 @@ connect to `vllm-server` via `vlm-http-client` backend
   >[!TIP]
   >
   >- Access `http://<server_ip>:7860` in your browser to use the Gradio WebUI.
-  >- Access `http://<server_ip>:7860/?view=api` to use the Gradio API.

+ 24 - 7
docs/en/quick_start/extension_modules.md

@@ -4,7 +4,7 @@ MinerU supports installing extension modules on demand based on different needs
 ## Common Scenarios
 
 ### Core Functionality Installation
-The `core` module is the core dependency of MinerU, containing all functional modules except `vllm`. Installing this module ensures the basic functionality of MinerU works properly.
+The `core` module is the core dependency of MinerU, containing all functional modules except `vllm`/`lmdeploy`. Installing this module ensures the basic functionality of MinerU works properly.
 ```bash
 uv pip install "mineru[core]"
 ```
@@ -12,18 +12,35 @@ uv pip install "mineru[core]"
 ---
 
 ### Using `vllm` to Accelerate VLM Model Inference
-The `vllm` module provides acceleration support for VLM model inference, suitable for graphics cards with Turing architecture and later (8GB+ VRAM). Installing this module can significantly improve model inference speed.
-In the configuration, `all` includes both `core` and `vllm` modules, so `mineru[all]` and `mineru[core,vllm]` are equivalent.
+> [!NOTE]
+> `vllm` and `lmdeploy` have nearly identical VLM inference acceleration effects and usage methods. You can choose one of them to install and use based on your actual needs, but it is not recommended to install both modules simultaneously to avoid potential dependency conflicts.
+
+The `vllm` module provides acceleration support for VLM model inference, suitable for graphics cards with Volta architecture and later (8GB+ VRAM). Installing this module can significantly improve model inference speed.
+
+```bash
+uv pip install "mineru[core,vllm]"
+```
+> [!TIP]
+> If exceptions occur during installation of the extra package including vllm, please refer to the [vllm official documentation](https://docs.vllm.ai/en/latest/getting_started/installation/index.html) to try to resolve the issue, or directly use the [Docker](./docker_deployment.md) deployment method.
+
+---
+
+### Using `lmdeploy` to Accelerate VLM Model Inference
+> [!NOTE]
+> `vllm` and `lmdeploy` have nearly identical VLM inference acceleration effects and usage methods. You can choose one of them to install and use based on your actual needs, but it is not recommended to install both modules simultaneously to avoid potential dependency conflicts.
+
+The `lmdeploy` module provides acceleration support for VLM model inference, suitable for graphics cards with Volta architecture and later (8GB+ VRAM). Installing this module can significantly improve model inference speed.
+
 ```bash
-uv pip install "mineru[all]"
+uv pip install "mineru[core,lmdeploy]"
 ```
 > [!TIP]
-> If exceptions occur during installation of the complete package including vllm, please refer to the [vllm official documentation](https://docs.vllm.ai/en/latest/getting_started/installation/index.html) to try to resolve the issue, or directly use the [Docker](./docker_deployment.md) deployment method.
+> If exceptions occur during installation of the extra package including lmdeploy, please refer to the [lmdeploy official documentation](https://lmdeploy.readthedocs.io/en/latest/get_started/installation.html) to try to resolve the issue.
 
 ---
 
-### Installing Lightweight Client to Connect to vllm-server
-If you need to install a lightweight client on edge devices to connect to `vllm-server`, you can install the basic mineru package, which is very lightweight and suitable for devices with only CPU and network connectivity.
+### Installing Lightweight Client to Connect to OpenAI-compatible servers
+If you need to install a lightweight client on edge devices to connect to an OpenAI-compatible server for using VLM mode, you can install the basic mineru package, which is very lightweight and suitable for devices with only CPU and network connectivity.
 ```bash
 uv pip install mineru
 ```

+ 16 - 10
docs/en/quick_start/index.md

@@ -31,12 +31,13 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
         <tr>
             <th rowspan="2">Parsing Backend</th>
             <th rowspan="2">pipeline <br> (Accuracy<sup>1</sup> 82+)</th>
-            <th colspan="4" style="text-align:center;">vlm (Accuracy<sup>1</sup> 90+)</th>
+            <th colspan="5">vlm (Accuracy<sup>1</sup> 90+)</th>
         </tr>
         <tr>
             <th>transformers</th>
             <th>mlx-engine</th>
             <th>vllm-engine / <br>vllm-async-engine</th>
+            <th>lmdeploy-engine</th>
             <th>http-client</th>
         </tr>
     </thead>
@@ -47,40 +48,42 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
             <td>Good compatibility, <br>but slower</td>
             <td>Faster than transformers</td>
             <td>Fast, compatible with the vLLM ecosystem</td>
-            <td>Suitable for OpenAI-compatible servers<sup>5</sup></td>
+            <td>Fast, compatible with the LMDeploy ecosystem</td>
+            <td>Suitable for OpenAI-compatible servers<sup>6</sup></td>
         </tr>
         <tr>
             <th>Operating System</th>
             <td colspan="2" style="text-align:center;">Linux<sup>2</sup> / Windows / macOS</td>
             <td style="text-align:center;">macOS<sup>3</sup></td>
             <td style="text-align:center;">Linux<sup>2</sup> / Windows<sup>4</sup> </td>
+            <td style="text-align:center;">Linux<sup>2</sup> / Windows<sup>5</sup> </td>
             <td>Any</td>
         </tr>
         <tr>
             <th>CPU inference support</th>
             <td colspan="2" style="text-align:center;">✅</td>
-            <td colspan="2" style="text-align:center;">❌</td>
+            <td colspan="3" style="text-align:center;">❌</td>
             <td>Not required</td>
         </tr>
         <tr>
             <th>GPU Requirements</th><td colspan="2" style="text-align:center;">Volta or later architectures, 6 GB VRAM or more, or Apple Silicon</td>
             <td>Apple Silicon</td>
-            <td>Volta or later architectures, 8 GB VRAM or more</td>
+            <td colspan="2" style="text-align:center;">Volta or later architectures, 8 GB VRAM or more</td>
             <td>Not required</td>
         </tr>
         <tr>
             <th>Memory Requirements</th>
-            <td colspan="4" style="text-align:center;">Minimum 16 GB, 32 GB recommended</td>
+            <td colspan="5" style="text-align:center;">Minimum 16 GB, 32 GB recommended</td>
             <td>8 GB</td>
         </tr>
         <tr>
             <th>Disk Space Requirements</th>
-            <td colspan="4" style="text-align:center;">20 GB or more, SSD recommended</td>
+            <td colspan="5" style="text-align:center;">20 GB or more, SSD recommended</td>
             <td>2 GB</td>
         </tr>
         <tr>
             <th>Python Version</th>
-            <td colspan="5" style="text-align:center;">3.10-3.13</td>
+            <td colspan="6" style="text-align:center;">3.10-3.13<sup>7</sup></td>
         </tr>
     </tbody>
 </table>
@@ -89,7 +92,10 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
 <sup>2</sup> Linux supports only distributions released in 2019 or later.  
 <sup>3</sup> MLX requires macOS 13.5 or later, recommended for use with version 14.0 or higher.  
 <sup>4</sup> Windows vLLM support via WSL2(Windows Subsystem for Linux).  
-<sup>5</sup> Servers compatible with the OpenAI API, such as local or remote model services deployed via inference frameworks like `vLLM`, `SGLang`, or `LMDeploy`.  
+<sup>5</sup> Windows LMDeploy can only use the `turbomind` backend, which is slightly slower than the `pytorch` backend. If performance is critical, it is recommended to run it via WSL2.  
+<sup>6</sup> Servers compatible with the OpenAI API, such as local or remote model services deployed via inference frameworks like `vLLM`, `SGLang`, or `LMDeploy`.  
+<sup>7</sup> Windows + LMDeploy only supports Python versions 3.10–3.12, as the critical dependency `ray` does not yet support Python 3.13 on Windows.
+
 
 ### Install MinerU
 
@@ -108,8 +114,8 @@ uv pip install -e .[core]
 ```
 
 > [!TIP]
-> `mineru[core]` includes all core features except `vllm` acceleration, compatible with Windows / Linux / macOS systems, suitable for most users.
-> If you need to use `vllm` acceleration for VLM model inference or install a lightweight client on edge devices, please refer to the documentation [Extension Modules Installation Guide](./extension_modules.md).
+> `mineru[core]` includes all core features except `vLLM`/`LMDeploy` acceleration, compatible with Windows / Linux / macOS systems, suitable for most users.
+> If you need to use `vLLM`/`LMDeploy` acceleration for VLM model inference or install a lightweight client on edge devices, please refer to the documentation [Extension Modules Installation Guide](./extension_modules.md).
 
 ---
  

+ 7 - 6
docs/en/usage/advanced_cli_parameters.md

@@ -1,8 +1,8 @@
 # Advanced Command Line Parameters
 
-## vllm Acceleration Parameter Optimization
+## Pass-through of inference engine parameters
 
-### Performance Optimization Parameters
+### vllm Acceleration Parameter Optimization
 > [!TIP]
 > If you can already use vllm normally for accelerated VLM model inference but still want to further improve inference speed, you can try the following parameters:
 > 
@@ -10,8 +10,9 @@
 
 ### Parameter Passing Instructions
 > [!TIP]
-> - All officially supported vllm parameters can be passed to MinerU through command line arguments, including the following commands: `mineru`, `mineru-vllm-server`, `mineru-gradio`, `mineru-api`
+> - All officially supported vllm/lmdeploy parameters can be passed to MinerU through command line arguments, including the following commands: `mineru`, `mineru-openai-server`, `mineru-gradio`, `mineru-api`
 > - If you want to learn more about `vllm` parameter usage, please refer to the [vllm official documentation](https://docs.vllm.ai/en/latest/cli/serve.html)
+> - If you want to learn more about `lmdeploy` parameter usage, please refer to the [lmdeploy official documentation](https://lmdeploy.readthedocs.io/en/latest/llm/api_server.html)
 
 ## GPU Device Selection and Configuration
 
@@ -21,7 +22,7 @@
 >   ```bash
 >   CUDA_VISIBLE_DEVICES=1 mineru -p <input_path> -o <output_path>
 >   ```
-> - This specification method is effective for all command line calls, including `mineru`, `mineru-vllm-server`, `mineru-gradio`, and `mineru-api`, and applies to both `pipeline` and `vlm` backends.
+> - This specification method is effective for all command line calls, including `mineru`, `mineru-openai-server`, `mineru-gradio`, and `mineru-api`, and applies to both `pipeline` and `vlm` backends.
 
 ### Common Device Configuration Examples
 > [!TIP]
@@ -38,9 +39,9 @@
 > [!TIP]
 > Here are some possible usage scenarios:
 > 
-> - If you have multiple graphics cards and need to specify cards 0 and 1, using multi-card parallelism to start `vllm-server`, you can use the following command:
+> - If you have multiple graphics cards and need to specify cards 0 and 1, using multi-card parallelism to start `openai-server`, you can use the following command:
 >   ```bash
->   CUDA_VISIBLE_DEVICES=0,1 mineru-vllm-server --port 30000 --data-parallel-size 2
+>   CUDA_VISIBLE_DEVICES=0,1 mineru-openai-server --engine vllm --port 30000 --data-parallel-size 2
 >   ```
 >       
 > - If you have multiple graphics cards and need to start two `fastapi` services on cards 0 and 1, listening on different ports respectively, you can use the following commands:

+ 1 - 1
docs/en/usage/cli_tools.md

@@ -11,7 +11,7 @@ Options:
   -p, --path PATH                 Input file path or directory (required)
   -o, --output PATH               Output directory (required)
   -m, --method [auto|txt|ocr]     Parsing method: auto (default), txt, ocr (pipeline backend only)
-  -b, --backend [pipeline|vlm-transformers|vlm-vllm-engine|vlm-http-client]
+  -b, --backend [pipeline|vlm-transformers|vlm-vllm-engine|vlm-lmdeploy-engine|vlm-http-client]
                                   Parsing backend (default: pipeline)
   -l, --lang [ch|ch_server|ch_lite|en|korean|japan|chinese_cht|ta|te|ka|th|el|latin|arabic|east_slavic|cyrillic|devanagari]
                                   Specify document language (improves OCR accuracy, pipeline backend only)

+ 11 - 5
docs/en/usage/quick_usage.md

@@ -29,7 +29,7 @@ mineru -p <input_path> -o <output_path>
 mineru -p <input_path> -o <output_path> -b vlm-transformers
 ```
 > [!TIP]
-> The vlm backend additionally supports `vllm` acceleration. Compared to the `transformers` backend, `vllm` can achieve 20-30x speedup. You can check the installation method for the complete package supporting `vllm` acceleration in the [Extension Modules Installation Guide](../quick_start/extension_modules.md).
+> The vlm backend additionally supports `vllm`/`lmdeploy` acceleration. Compared to the `transformers` backend, inference speed can be significantly improved. You can check the installation method for the complete package supporting `vllm`/`lmdeploy` acceleration in the [Extension Modules Installation Guide](../quick_start/extension_modules.md).
 
 If you need to adjust parsing options through custom parameters, you can also check the more detailed [Command Line Tools Usage Instructions](./cli_tools.md) in the documentation.
 
@@ -48,6 +48,8 @@ If you need to adjust parsing options through custom parameters, you can also ch
   mineru-gradio --server-name 0.0.0.0 --server-port 7860
   # Or using vlm-vllm-engine/pipeline backends (requires vllm environment)
   mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-vllm-engine true
+  # Or using vlm-lmdeploy-engine/pipeline backends (requires lmdeploy environment)
+  mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-lmdeploy-engine true
   ```
   >[!TIP]
   >
@@ -55,8 +57,12 @@ If you need to adjust parsing options through custom parameters, you can also ch
 
 - Using `http-client/server` method:
   ```bash
-  # Start vllm server (requires vllm environment)
-  mineru-vllm-server --port 30000
+  # Start openai compatible server (requires vllm or lmdeploy environment)
+  mineru-openai-server
+  # Or start vllm server (requires vllm environment)
+  mineru-openai-server --engine vllm --port 30000
+  # Or start lmdeploy server (requires lmdeploy environment)
+  mineru-openai-server --engine lmdeploy --server-port 30000
   ``` 
   >[!TIP]
   >In another terminal, connect to vllm server via http client (only requires CPU and network, no vllm environment needed)
@@ -65,8 +71,8 @@ If you need to adjust parsing options through custom parameters, you can also ch
   > ```
 
 > [!NOTE]
-> All officially supported vllm parameters can be passed to MinerU through command line arguments, including the following commands: `mineru`, `mineru-vllm-server`, `mineru-gradio`, `mineru-api`.
-> We have compiled some commonly used parameters and usage methods for `vllm`, which can be found in the documentation [Advanced Command Line Parameters](./advanced_cli_parameters.md).
+> All officially supported `vllm/lmdeploy` parameters can be passed to MinerU through command line arguments, including the following commands: `mineru`, `mineru-openai-server`, `mineru-gradio`, `mineru-api`.
+> We have compiled some commonly used parameters and usage methods for `vllm/lmdeploy`, which can be found in the documentation [Advanced Command Line Parameters](./advanced_cli_parameters.md).
 
 ## Extending MinerU Functionality with Configuration Files
 

+ 7 - 8
docs/zh/quick_start/docker_deployment.md

@@ -19,7 +19,7 @@ Mineru的docker使用了`vllm/vllm-openai`作为基础镜像,因此在docker
 > [!NOTE]
 > 使用`vllm`加速VLM模型推理需要满足的条件是:
 > 
-> - 设备包含Turing及以后架构的显卡,且可用显存大于等于8G。
+> - 设备包含Volta及以后架构的显卡,且可用显存大于等于8G。
 > - 物理机的显卡驱动应支持CUDA 12.8或更高版本,可通过`nvidia-smi`命令检查驱动版本。
 > - docker中能够访问物理机的显卡设备。
 
@@ -50,17 +50,17 @@ wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/compose.yaml
 >  
 >- `compose.yaml`文件中包含了MinerU的多个服务配置,您可以根据需要选择启动特定的服务。
 >- 不同的服务可能会有额外的参数配置,您可以在`compose.yaml`文件中查看并编辑。
->- 由于`vllm`推理加速框架预分配显存的特性,您可能无法在同一台机器上同时运行多个`vllm`服务,因此请确保在启动`vlm-vllm-server`服务或使用`vlm-vllm-engine`后端时,其他可能使用显存的服务已停止。
+>- 由于`vllm`推理加速框架预分配显存的特性,您可能无法在同一台机器上同时运行多个`vllm`服务,因此请确保在启动`vlm-openai-server`服务或使用`vlm-vllm-engine`后端时,其他可能使用显存的服务已停止。
 
 ---
 
-### 启动 vllm-server 服务
-并通过`vlm-http-client`后端连接`vllm-server`
+### 启动 openai兼容接口 服务
+并通过`vlm-http-client`后端连接`openai-server`
   ```bash
-  docker compose -f compose.yaml --profile vllm-server up -d
+  docker compose -f compose.yaml --profile openai-server up -d
   ```
   >[!TIP]
-  >在另一个终端中通过http client连接vllm server(只需cpu与网络,不需要vllm环境)
+  >在另一个终端中通过http client连接openai server(只需cpu与网络,不需要vllm环境)
   > ```bash
   > mineru -p <input_path> -o <output_path> -b vlm-http-client -u http://<server_ip>:30000
   > ```
@@ -82,5 +82,4 @@ wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/compose.yaml
   ```
   >[!TIP]
   > 
-  >- 在浏览器中访问 `http://<server_ip>:7860` 使用 Gradio WebUI。
-  >- 访问 `http://<server_ip>:7860/?view=api` 使用 Gradio API。
+  >- 在浏览器中访问 `http://<server_ip>:7860` 使用 Gradio WebUI。

+ 22 - 7
docs/zh/quick_start/extension_modules.md

@@ -4,7 +4,7 @@ MinerU 支持根据不同需求,按需安装扩展模块,以增强功能或
 ## 常见场景
 
 ### 核心功能安装
-`core` 模块是 MinerU 的核心依赖,包含了除`vllm`外的所有功能模块。安装此模块可以确保 MinerU 的基本功能正常运行。
+`core` 模块是 MinerU 的核心依赖,包含了除`vllm`/`lmdeploy`外的所有功能模块。安装此模块可以确保 MinerU 的基本功能正常运行。
 ```bash
 uv pip install "mineru[core]"
 ```
@@ -12,18 +12,33 @@ uv pip install "mineru[core]"
 ---
 
 ### 使用`vllm`加速 VLM 模型推理
-`vllm` 模块提供了对 VLM 模型推理的加速支持,适用于具有 Turing 及以后架构的显卡(8G 显存及以上)。安装此模块可以显著提升模型推理速度。
-在配置中,`all`包含了`core`和`vllm`模块,因此`mineru[all]`和`mineru[core,vllm]`是等价的。
+> [!NOTE]
+> `vllm`和`lmdeploy`对vlm的推理加速效果和使用方式几乎相同,您可以根据实际情况选择其中之一进行安装和使用,但不建议同时安装这两个模块,以避免潜在的依赖冲突。
+
+`vllm` 模块提供了对 VLM 模型推理的加速支持,适用于具有 Volta 及以后架构的显卡(8G 显存及以上)。安装此模块可以显著提升模型推理速度。
+```bash
+uv pip install "mineru[core,vllm]"
+```
+> [!TIP]
+> 如在安装包含`vllm`的扩展包过程中发生异常,请参考 [vllm 官方文档](https://docs.vllm.ai/en/latest/getting_started/installation/index.html) 尝试解决,或直接使用 [Docker](./docker_deployment.md) 方式部署镜像。
+
+---
+
+### 使用`lmdeploy`加速 VLM 模型推理
+> [!NOTE]
+> `vllm`和`lmdeploy`对vlm的推理加速效果和使用方式几乎相同,您可以根据实际情况选择其中之一进行安装和使用,但不建议同时安装这两个模块,以避免潜在的依赖冲突。
+
+`lmdeploy` 模块提供了对 VLM 模型推理的加速支持,适用于具有 Volta 及以后架构的显卡(8G 显存及以上)。安装此模块可以显著提升模型推理速度。
 ```bash
-uv pip install "mineru[all]"
+uv pip install "mineru[core,lmdeploy]"
 ```
 > [!TIP]
-> 如在安装包含vllm的完整包过程中发生异常,请参考 [vllm 官方文档](https://docs.vllm.ai/en/latest/getting_started/installation/index.html) 尝试解决,或直接使用 [Docker](./docker_deployment.md) 方式部署镜像。
+> 如在安装包含`lmdeploy`的扩展包过程中发生异常,请参考 [lmdeploy 官方文档](https://lmdeploy.readthedocs.io/en/latest/get_started/installation.html) 尝试解决
 
 ---
 
-### 安装轻量版client连接vllm-server使用
-如果您需要在边缘设备上安装轻量版的 client 端以连接 `vllm-server`,可以安装mineru的基础包,非常轻量,适合在只有cpu和网络连接的设备上使用。
+### 安装轻量版client连接兼容openai服务器使用
+如果您需要在边缘设备上安装轻量版的 client 端以连接兼容 openai 接口的服务端来使用vlm模式,可以安装mineru的基础包,非常轻量,适合在只有cpu和网络连接的设备上使用。
 ```bash
 uv pip install mineru
 ```

+ 16 - 10
docs/zh/quick_start/index.md

@@ -31,12 +31,13 @@
         <tr>
             <th rowspan="2">解析后端</th>
             <th rowspan="2">pipeline <br> (精度<sup>1</sup> 82+)</th>
-            <th colspan="4" style="text-align:center;">vlm (精度<sup>1</sup> 90+)</th>
+            <th colspan="5">vlm (精度<sup>1</sup> 90+)</th>
         </tr>
         <tr>
             <th>transformers</th>
             <th>mlx-engine</th>
             <th>vllm-engine / <br>vllm-async-engine</th>
+            <th>lmdeploy-engine</th>
             <th>http-client</th>
         </tr>
     </thead>
@@ -47,40 +48,42 @@
             <td>兼容性好, 速度较慢</td>
             <td>比transformers快</td>
             <td>速度快, 兼容vllm生态</td>
-            <td>适用于OpenAI兼容服务器<sup>5</sup></td>
+            <td>速度快, 兼容lmdeploy生态</td>
+            <td>适用于OpenAI兼容服务器<sup>6</sup></td>
         </tr>
         <tr>
             <th>操作系统</th>
             <td colspan="2" style="text-align:center;">Linux<sup>2</sup> / Windows / macOS</td>
             <td style="text-align:center;">macOS<sup>3</sup></td>
             <td style="text-align:center;">Linux<sup>2</sup> / Windows<sup>4</sup> </td>
+            <td style="text-align:center;">Linux<sup>2</sup> / Windows<sup>5</sup> </td>
             <td>不限</td>
         </tr>
         <tr>
             <th>CPU推理支持</th>
             <td colspan="2" style="text-align:center;">✅</td>
-            <td colspan="2" style="text-align:center;">❌</td>
+            <td colspan="3" style="text-align:center;">❌</td>
             <td >不需要</td>
         </tr>
         <tr>
             <th>GPU要求</th><td colspan="2" style="text-align:center;">Volta及以后架构, 6G显存以上或Apple Silicon</td>
             <td>Apple Silicon</td>
-            <td>Volta及以后架构, 8G显存以上</td>
+            <td colspan="2" style="text-align:center;">Volta及以后架构, 8G显存以上</td>
             <td>不需要</td>
         </tr>
         <tr>
             <th>内存要求</th>
-            <td colspan="4" style="text-align:center;">最低16GB以上, 推荐32GB以上</td>
+            <td colspan="5" style="text-align:center;">最低16GB以上, 推荐32GB以上</td>
             <td>8GB</td>
         </tr>
         <tr>
             <th>磁盘空间要求</th>
-            <td colspan="4" style="text-align:center;">20GB以上, 推荐使用SSD</td>
+            <td colspan="5" style="text-align:center;">20GB以上, 推荐使用SSD</td>
             <td>2GB</td>
         </tr>
         <tr>
             <th>python版本</th>
-            <td colspan="5" style="text-align:center;">3.10-3.13</td>
+            <td colspan="6" style="text-align:center;">3.10-3.13<sup>7</sup></td>
         </tr>
     </tbody>
 </table> 
@@ -89,7 +92,10 @@
 <sup>2</sup> Linux仅支持2019年及以后发行版  
 <sup>3</sup> MLX需macOS 13.5及以上版本支持,推荐14.0以上版本使用  
 <sup>4</sup> Windows vLLM通过WSL2(适用于 Linux 的 Windows 子系统)实现支持  
-<sup>5</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务  
+<sup>5</sup> Windows LMDeploy只能使用`turbomind`后端,速度比`pytorch`后端稍慢,如对速度有要求建议通过WSL2运行  
+<sup>6</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务  
+<sup>7</sup> Windows + LMDeploy 由于关键依赖`ray`未能在windows平台支持Python 3.13,故仅支持至3.10~3.12版本  
+
 
 > [!TIP]
 > 除以上主流环境与平台外,我们也收录了一些社区用户反馈的其他平台支持情况,详情请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)。  
@@ -113,8 +119,8 @@ uv pip install -e .[core] -i https://mirrors.aliyun.com/pypi/simple
 ```
 
 > [!TIP]
-> `mineru[core]`包含除`vllm`加速外的所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
-> 如果您有使用`vllm`加速VLM模型推理,或是在边缘设备安装轻量版client端等需求,可以参考文档[扩展模块安装指南](./extension_modules.md)。
+> `mineru[core]`包含除`vLLM`/`LMDeploy`加速外的所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
+> 如果您需要使用`vLLM`/`LMDeploy`加速VLM模型推理,或是有在边缘设备安装轻量版client端等需求,可以参考文档[扩展模块安装指南](./extension_modules.md)。
 
 ---
  

+ 160 - 57
docs/zh/usage/acceleration_cards/Ascend.md

@@ -1,64 +1,167 @@
-#### 1 系统
-NAME="Ubuntu"
-VERSION="20.04.6 LTS (Focal Fossa)"
-昇腾910B2
-驱动 23.0.6.2
-CANN 7.5.X
-Miner U 2.1.9
-#### 2 踩坑记录
-坑1: **图形库相关的问题,总之就是动态库导致TLS的内存分配失败(OpenCV库在ARM64架构上的兼容性问题)**
-⭐这个错误 ImportError: /lib/aarch64-linux-gnu/libGLdispatch.so.0: cannot allocate memory in static TLS block 是由于OpenCV库在ARM64架构上的兼容性问题导致的。从错误堆栈可以看到,问题出现在导入cv2模块时,这发生在MinerU的VLM后端初始化过程中。
-解决方法:
-1 安装减少内存问题的opencv版本
+## 1. 测试平台
+以下为本指南测试使用的平台信息,供参考:
+```
+os: CTyunOS 22.06  
+cpu: Kunpeng-920 (aarch64)  
+npu: Ascend 910B2  
+driver: 23.0.3 
+docker: 20.10.12
 ```
-pip install --upgrade albumentations albucore simsimd# Uninstall current opencv
-pip uninstall opencv-python opencv-contrib-python
 
-# Install headless version (no GUI dependencies)
-pip install opencv-python-headless
+## 2. 环境准备
 
-python -c "import cv2; print(cv2.__version__)"2 apt-get install一些包
-```
-换成清华源然后重命名为sources.list.tuna,然后挪到根目录下面
-```
-deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
-deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
-deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
-deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiversesudo apt-get update -o Dir::Etc::sourcelist="sources.list.tuna" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-sudo apt-get install libgl1-mesa-glx -o Dir::Etc::sourcelist="sources.list.tuna" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-sudo apt-get install libglib2.0-0 libsm6 libxext6 libxrender-dev libgomp1 -o Dir::Etc::sourcelist="sources.list.tuna" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-sudo apt-get install libgl1-mesa-dev libgles2-mesa-dev -o Dir::Etc::sourcelist="sources.list.tuna" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-sudo apt-get install libgomp1 -o Dir::Etc::sourcelist="sources.list.tuna" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
-export OPENCV_IO_ENABLE_OPENEXR=0  export QT_QPA_PLATFORM=offscreen
-```
-↑这些不知道哪些好使,或者有没有好使的
+>[!NOTE]
+>Ascend加速卡支持使用`vllm`或`lmdeploy`进行VLM模型推理加速。请根据实际需求选择安装和使用其中之一:
 
-3  强制覆盖conda环境自带的动态库(conda的和系统的冲突)
-```
-查找:find /usr/lib /lib /root/.local/conda -name "libgomp.so*" 2>/dev/null
-export LD_PRELOAD="/usr/lib/aarch64-linux-gnu/libstdc++.so.6:/usr/lib/aarch64-linux-gnu/libgomp.so.1"
-export LD_PRELOAD=/lib/aarch64-linux-gnu/libGLdispatch.so.0:$LD_PRELOAD
-```
-此外,还可以把conda环境中自带的的强制挪走
-```
-mv $CONDA_PREFIX/lib/libstdc++.so.6 $CONDA_PREFIX/lib/libstdc++.so.6.bak
-mv $CONDA_PREFIX/lib/libgomp.so.1 $CONDA_PREFIX/lib/libgomp.so.1.bak
-mv $CONDA_PREFIX/lib/libGLdispatch.so.0 $CONDA_PREFIX/lib/libGLdispatch.so.0.bak  # 如果有的话
-simsimd包相关:
-mv /root/.local/conda/envs/pdfparser/lib/python3.10/site-packages/simsimd./libgomp-947d5fa1.so.1.0.0 /root/.local/conda/envs/pdfparser/lib/python3.10/site-packages/simsimd./libgomp-947d5fa1.so.1.0.0.bak
-```
-或者:
-降级simsimd                3.7.2
-降级albumentations         1.3.1
-sklean包相关:
+### 2.1 使用 Dockerfile 构建镜像 (vllm)
+
+```bash
+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile
+docker build --network=host -t mineru:npu-vllm-latest -f npu.Dockerfile .
+``` 
+
+### 2.2 使用 Dockerfile 构建镜像 (lmdeploy)
+
+```bash
+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile
+# 将基础镜像从 vllm 切换为 lmdeploy
+sed -i '3s/^/# /' npu.Dockerfile && sed -i '5s/^# //' npu.Dockerfile
+docker build --network=host -t mineru:npu-lmdeploy-latest -f npu.Dockerfile .
 ```
-# 找到 scikit-learn 内部的 libgomp 路径
-SKLEARN_LIBGOMP="/root/.local/conda/envs/pdfparser/lib/python3.10/site-packages/scikit_learn.libs/libgomp-947d5fa1.so.1.0.0"
 
-# 预加载这个特定的 libgomp 版本
-export LD_PRELOAD="$SKLEARN_LIBGOMP:$LD_PRELOAD"
+## 3. 启动 Docker 容器
+
+```bash
+docker run -u root --name mineru_docker --privileged=true \
+    --ipc=host \
+    --network=host \
+    --device=/dev/davinci0 \
+    --device=/dev/davinci1 \
+    --device=/dev/davinci2 \
+    --device=/dev/davinci3 \
+    --device=/dev/davinci4 \
+    --device=/dev/davinci5 \
+    --device=/dev/davinci6 \
+    --device=/dev/davinci7 \
+    --device=/dev/davinci_manager \
+    --device=/dev/devmm_svm \
+    --device=/dev/hisi_hdc \
+    -v /var/log/npu/:/usr/slog \
+    -v /usr/local/dcmi:/usr/local/dcmi \
+    -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
+    -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
+    -e MINERU_MODEL_SOURCE=local \
+    -e MINERU_LMDEPLOY_DEVICE=ascend \
+    -it mineru:npu-vllm-latest \
+    /bin/bash
 ```
-4 其他
-torch / torch_npu 2.5.1
-pip install "numpy<2.0" 2.0和昇腾不兼容
-export MINERU_MODEL_SOURCE=modelscope
+
+>[!TIP]
+> 请根据实际情况选择使用`vllm`或`lmdeploy`版本的镜像,如需使用lmdeploy,替换上述命令中的`mineru:npu-vllm-latest`为`mineru:npu-lmdeploy-latest`即可。
+
+执行该命令后,您将进入到Docker容器的交互式终端,您可以直接在容器内运行MinerU相关命令来使用MinerU的功能。
+您也可以直接通过替换`/bin/bash`为服务启动命令来启动MinerU服务,详细说明请参考[通过命令启动服务](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuihttp-clientserver)。
+
+## 4. 注意事项
+
+不同环境下,MinerU对Ascend加速卡的支持情况如下表所示:
+
+<table border="1">
+  <thead>
+    <tr>
+      <th rowspan="2" colspan="2">使用场景</th>
+      <th colspan="2">容器环境</th>
+    </tr>
+    <tr>
+      <th>vllm</th>
+      <th>lmdeploy</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td rowspan="4">命令行工具(mineru)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🔴</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">fastapi服务(mineru-api)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">gradio界面(mineru-gradio)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">openai-server服务(mineru-openai-server)</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">数据并行 (--data-parallel-size/--dp)</td>
+      <td>🟢</td>
+      <td>🔴</td>
+    </tr>
+  </tbody>
+</table>
+
+注:  
+🟢: 支持,运行较稳定,精度与Nvidia GPU基本一致  
+🟡: 支持但较不稳定,在某些场景下可能出现异常,或精度存在一定差异  
+🔴: 不支持,无法运行,或精度存在较大差异  
+
+>[!NOTE]
+>由于npu卡的特殊性,单次服务启动后,可能会在运行过程中切换推理后端(backend)类型(pipeline/vlm)时出现异常,请尽量根据实际需求选择合适的推理后端进行使用。  
+>如在服务中切换推理后端类型遇到报错或异常,请重新启动服务即可。
+
+>[!TIP]
+>NPU加速卡指定可用加速卡的方式与NVIDIA GPU类似,请参考[ASCEND_RT_VISIBLE_DEVICES](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/850alpha001/maintenref/envvar/envref_07_0028.html)

+ 253 - 0
docs/zh/usage/acceleration_cards/Cambricon.md

@@ -0,0 +1,253 @@
+# MinerU
+## 1. 环境准备
+容器启动方式见第3节
+### 1.1 获取代码
+```
+git clone https://github.com/opendatalab/MinerU.git
+git checkout fa1149cd4abf9db5e0f13e4e074cdb568be189f4
+```
+### 1.2 安装依赖
+```
+source /torch/venv3/pytorch_infer/bin/activate
+pip install accelerate==1.11.0 doclayout_yolo==0.0.4 thop==0.1.1.post2209072238 ultralytics-thop==2.0.18 ultralytics==8.3.228
+# requirements_check.txt具体内容在下面
+pip install -r requirements_check.txt
+cd MinerU
+pip install -e .[core] --no-deps
+```
+requirements_check.txt
+```
+# triton==3.0.0+mlu1.3.1
+# torch==2.5.0+cpu
+# torchvision==0.20.0+cpu
+
+
+# === 1. 已安装且版本相同 ===
+# (这些包已满足要求, 无需操作)
+
+
+# === 2. 已安装但版本不同 ===
+# (运行 pip install -r 将强制更新到左侧的目标版本)
+# accelerate==1.11.0 # 0.33.0
+beautifulsoup4==4.14.2 # 4.12.3
+cffi==2.0.0 # 1.17.1
+huggingface-hub==0.36.0 # 0.25.2
+jiter==0.12.0 # 0.8.2
+openai==2.8.0 # 1.59.7
+pillow==11.3.0 # 10.4.0
+sympy==1.14.0 # 1.13.1
+tokenizers==0.22.1 # 0.21.0
+# torch==2.9.1 # 2.5.0+cpu
+# torchvision==0.24.1 # 0.20.0+cpu
+transformers==4.57.1 # 4.48.0
+# triton==3.5.1 # 3.0.0+mlu1.3.1
+typing-extensions==4.15.0 # 4.12.2
+
+# === 3. 未安装 ===
+# (运行 pip install -r 将安装这些包)
+aiofiles==24.1.0
+albucore==0.0.24
+albumentations==2.0.8
+antlr4-python3-runtime==4.9.3
+brotli==1.2.0
+coloredlogs==15.0.1
+colorlog==6.10.1
+cryptography==46.0.3
+# doclayout_yolo==0.0.4
+fast-langdetect==0.2.5
+fasttext-predict==0.9.2.4
+ffmpy==1.0.0
+flatbuffers==25.9.23
+ftfy==6.3.1
+gradio-client==1.13.3
+gradio-pdf==0.0.22
+gradio==5.49.1
+groovy==0.1.2
+hf-xet==1.2.0
+httpx-retries==0.4.5
+humanfriendly==10.0
+imageio==2.37.2
+json-repair==0.53.0
+magika==0.6.3
+markdown-it-py==4.0.0
+mdurl==0.1.2
+mineru-vl-utils==0.1.15
+mineru==2.6.4
+modelscope==1.31.0
+# nvidia-cublas-cu12==12.8.4.1
+# nvidia-cuda-cupti-cu12==12.8.90
+# nvidia-cuda-nvrtc-cu12==12.8.93
+# nvidia-cuda-runtime-cu12==12.8.90
+# nvidia-cudnn-cu12==9.10.2.21
+# nvidia-cufft-cu12==11.3.3.83
+# nvidia-cufile-cu12==1.13.1.3
+# nvidia-curand-cu12==10.3.9.90
+# nvidia-cusolver-cu12==11.7.3.90
+# nvidia-cusparse-cu12==12.5.8.93
+# nvidia-cusparselt-cu12==0.7.1
+# nvidia-nccl-cu12==2.27.5
+# nvidia-nvjitlink-cu12==12.8.93
+# nvidia-nvshmem-cu12==3.3.20
+# nvidia-nvtx-cu12==12.8.90
+omegaconf==2.3.0
+onnxruntime==1.23.2
+orjson==3.11.4
+pdfminer.six==20250506
+pdftext==0.6.3
+polars-runtime-32==1.35.2
+polars==1.35.2
+pyclipper==1.3.0.post6
+pydantic-settings==2.12.0
+pydub==0.25.1
+pypdf==6.2.0
+pypdfium2==4.30.0
+python-multipart==0.0.20
+reportlab==4.4.4
+rich==14.2.0
+robust-downloader==0.0.2
+ruff==0.14.5
+safehttpx==0.1.7
+scikit-image==0.25.2
+seaborn==0.13.2
+semantic-version==2.10.0
+shapely==2.1.2
+shellingham==1.5.4
+simsimd==6.5.3
+stringzilla==4.2.3
+# thop==0.1.1.post2209072238
+tifffile==2025.5.10
+typer==0.20.0
+typing-inspection==0.4.2
+# ultralytics-thop==2.0.18
+# ultralytics==8.3.228
+```
+### 1.3 修改代码
+/raid_data/home/yqk/mineru-251114/MinerU/mineru/backend/pipeline/pipeline_analyze.py, line 1
+添加代码
+```
+# 添加MLU支持
+import torch_mlu.utils.gpu_migration
+# 高版本镜像为
+# import torch.mlu.utils.gpu_migration
+```
+
+## 2. 使用方法
+```
+export HF_ENDPOINT=https://hf-mirror.com
+mineru-api --host 0.0.0.0 --port 8009
+```
+
+## 3. 其他
+
+### 3.1 Dify插件配置问题
+给Dify的MinerU插件使用时,需将Dify的.env文件中FILES_URL设置为http://{ip}:{dify的网页访问端口}。
+根据网上找到的很多回答可能是要暴露5001,并将FILES_URL设置为http://{ip}:5001,并暴露5001端口,但其实设置为dify的网页访问端口即可。
+
+### 3.2 容器启动方式
+
+```
+export MY_CONTAINER="[容器名称]"
+num=`docker ps -a|grep "$MY_CONTAINER" | wc -l`
+echo $num
+echo $MY_CONTAINER
+if [ 0 -eq $num ];then
+docker run -d \
+        --privileged \
+        --pid=host \
+        --net=host \
+        --shm-size 64g \
+        --device /dev/cambricon_dev0 \
+        --device /dev/cambricon_ipcm0 \
+        --device /dev/cambricon_ctl \
+        --name $MY_CONTAINER \
+        -v [/path/to/your/data:/path/to/your/data] \
+        -v /usr/bin/cnmon:/usr/bin/cnmon \
+        [镜像名称] \
+        sleep infinity
+docker exec -ti $MY_CONTAINER /bin/bash
+else
+    docker start $MY_CONTAINER
+    docker exec -ti $MY_CONTAINER /bin/bash
+fi
+```
+
+### 3.3 将上面的过程进行打包
+
+准备好前面的requirements_check.txt
+
+Dockerfile
+
+```
+# 1. 使用指定的基础镜像
+FROM cambricon-base/pytorch:v25.01-torch2.5.0-torchmlu1.24.1-ubuntu22.04-py310
+
+# 2. 设置环境变量
+ENV HF_ENDPOINT=https://hf-mirror.com
+
+# 3. 定义 venv_pip 路径以便复用
+# 基础镜像中的虚拟环境路径
+ARG VENV_PIP=/torch/venv3/pytorch_infer/bin/pip
+
+# 4. 设置工作目录
+WORKDIR /app
+
+# 5. 安装 git (基础镜像可能不包含)
+RUN apt-get update && apt-get install -y git && \
+    rm -rf /var/lib/apt/lists/*
+
+# 6. 复制 requirements_check.txt 到镜像中
+# (这个文件需要您在宿主机上和 Dockerfile 放在同一目录下)
+COPY requirements_check.txt .
+
+# 7. 步骤 1.1 & 1.2: 获取代码并安装所有依赖
+#    在一个 RUN 层中执行所有安装,以优化镜像大小
+RUN \
+    # 1.1 获取代码
+    echo "Cloning MinerU repository..." && \
+    git clone https://gh-proxy.org/https://github.com/opendatalab/MinerU.git && \
+    cd MinerU && \
+    git checkout fa1149cd4abf9db5e0f13e4e074cdb568be189f4 && \
+    cd .. && \
+    \
+    # 1.2 安装依赖
+    # 第1个pip install (来自您的步骤)
+    echo "Installing initial dependencies..." && \
+    ${VENV_PIP} install accelerate==1.11.0 doclayout_yolo==0.0.4 thop==0.1.1.post2209072238 ultralytics-thop==2.0.18 ultralytics==8.3.228 && \
+    \
+    # 第2个pip install (来自 requirements_check.txt)
+    echo "Installing dependencies from requirements_check.txt..." && \
+    # 注意:基础镜像已包含 torch 和 triton,requirements_check.txt 中的注释行会被 pip 自动忽略
+    ${VENV_PIP} install -r requirements_check.txt && \
+    \
+    # 第3个pip install (本地安装 MinerU)
+    echo "Installing MinerU in editable mode..." && \
+    cd MinerU && \
+    ${VENV_PIP} install -e .[core] --no-deps
+
+# 8. 步骤 1.3: 修改代码
+#    将 MLU 支持代码添加到指定文件的开头
+RUN echo "Applying MLU patch to pipeline_analyze.py..." && \
+    sed -i '1i# 添加MLU支持\nimport torch_mlu.utils.gpu_migration\n# 高版本镜像为\n# import torch.mlu.utils.gpu_migration\n' \
+    /app/MinerU/mineru/backend/pipeline/pipeline_analyze.py
+```
+
+该镜像的启动
+
+```
+docker run -d --restart=always \
+    --privileged \
+    --pid=host \
+    --net=host \
+    --shm-size 64g \
+    --device /dev/cambricon_dev0 \
+    --device /dev/cambricon_ipcm0 \
+    --device /dev/cambricon_ctl \
+    --name mineru_service \
+    mineru-mlu:latest \
+    /torch/venv3/pytorch_infer/bin/python /app/MinerU/mineru/cli/fast_api.py --host 0.0.0.0 --port 8009
+```
+
+
+
+
+

+ 148 - 100
docs/zh/usage/acceleration_cards/METAX.md

@@ -1,117 +1,165 @@
-## 在C500+MACA上部署并使用Mineru
-
-### 获取MACA镜像,包含torch-maca,maca,sglang-maca
-
-镜像获取地址:https://developer.metax-tech.com/softnova/docker ,
-选择maca-c500-pytorch:2.33.0.6-ubuntu22.04-amd64
-
-若在docker上部署镜像则需要启动GPU设备访问
-```bash
-docker run --device=/dev/dri --device=/dev/mxcd....
+## 1. 测试平台
+以下为本指南测试使用的平台信息,供参考:
+```
+os: Ubuntu 22.04   
+cpu: INTEL x86_64
+gpu: C500  
+driver: 2.12.13
+docker: 28.1.1
 ```
 
-#### 注意事项
+## 2. 环境准备
 
-由于此镜像默认开启TORCH_ALLOW_TF32_CUBLAS_OVERRIDE,会导致backed:vlm-transformers推理结果错误
+>[!NOTE]
+>maca加速卡支持使用`vllm`或`lmdeploy`进行VLM模型推理加速。请根据实际需求选择安装和使用其中之一:
 
-```bash
-unset TORCH_ALLOW_TF32_CUBLAS_OVERRIDE
-```
+### 2.1 使用metax官方镜像作为基础镜像构建vllm环境镜像
 
-### 安装MinerU
+- 1. 从metax官方仓库拉取基础镜像
+    - 1.1 镜像获取地址:https://developer.metax-tech.com/softnova/docker  
+    - 1.2 在镜像网站选择`AI`分类,软件包类型选择`vllm`,操作系统选择`ubuntu` 
+    - 1.3 找到`vllm:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-amd64`镜像,复制拉取命令并在本地终端执行
+- 2. 使用 Dockerfile 构建镜像 (vllm)
+    ```bash
+    wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/maca.Dockerfile
+    docker build --network=host -t mineru:maca-vllm-latest -f maca.Dockerfile .
+    ```
+  
+### 2.2 使用 Dockerfile 构建镜像 (lmdeploy)
 
-使用--no-deps,去除对一些cuda版本包的依赖,后续采用pip install-r requirements.txt 安装其他依赖
 ```bash
-pip install -U "mineru[core]" --no-deps
+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/maca.Dockerfile
+# 将基础镜像从 vllm 切换为 lmdeploy
+sed -i '3s/^/# /' maca.Dockerfile && sed -i '5s/^# //' maca.Dockerfile
+docker build --network=host -t mineru:maca-lmdeploy-latest -f maca.Dockerfile .
 ```
 
-```tex
-boto3>=1.28.43
-click>=8.1.7
-loguru>=0.7.2
-numpy==1.26.4
-pdfminer.six==20250506
-tqdm>=4.67.1
-requests
-httpx
-pillow>=11.0.0
-pypdfium2>=4.30.0
-pypdf>=5.6.0
-reportlab
-pdftext>=0.6.2
-modelscope>=1.26.0
-huggingface-hub>=0.32.4
-json-repair>=0.46.2
-opencv-python>=4.11.0.86
-fast-langdetect>=0.2.3,<0.3.0
-transformers>=4.51.1
-accelerate>=1.5.1
-pydantic
-matplotlib>=3.10,<4
-ultralytics>=8.3.48,<9
-dill>=0.3.8,<1
-rapid_table>=1.0.5,<2.0.0
-PyYAML>=6.0.2,<7 
-ftfy>=6.3.1,<7
-openai>=1.70.0,<2
-shapely>=2.0.7,<3
-pyclipper>=1.3.0,<2
-omegaconf>=2.3.0,<3
-transformers>=4.49.0,!=4.51.0,<5.0.0
-fastapi
-python-multipart
-uvicorn
-gradio>=5.34,<6
-gradio-pdf>=0.0.22
-albumentations
-beautifulsoup4
-scikit-image==0.25.0
-outlines==0.1.11
-magika>=0.6.2,<0.7.0
-mineru-vl-utils>=0.1.6,<1
-```
-上述内容保存为requirments.txt,进行安装
-```bash
-pip install -r requirments.txt
-```
-安装doclayout_yolo,这里doclayout_yolo会依赖torch-cuda,使用--no-deps
+## 3. 启动 Docker 容器
+
 ```bash
-pip install doclayout-yolo --no-deps
+docker run --ipc host \
+   --cap-add SYS_PTRACE \
+   --privileged=true \
+   --device=/dev/mem \
+   --device=/dev/dri \
+   --device=/dev/mxcd \
+   --device=/dev/infiniband \
+   --group-add video \
+   --network=host \
+   --shm-size '100gb' \
+   --ulimit memlock=-1 \
+   --security-opt seccomp=unconfined \
+   --security-opt apparmor=unconfined \
+   --name mineru_docker \
+   -v /datapool:/datapool \
+   -e MINERU_MODEL_SOURCE=local \
+   -e MINERU_LMDEPLOY_DEVICE=maca \
+   -it mineru:maca-vllm-latest \
+   /bin/bash
 ```
-### 在线使用
-**基础使用命令为:mineru -p <input_path> -o <output_path> -b vlm-transformers**
 
-- `<input_path>`: Local PDF/image file or directory
-- `<output_path>`: Output directory
-- -b  --backend [pipeline|vlm-transformers|vlm-vllm-engine|vlm-http-client] (default:pipeline)<br/>
+>[!TIP]
+> 请根据实际情况选择使用`vllm`或`lmdeploy`版本的镜像,如需使用lmdeploy,替换上述命令中的`mineru:maca-vllm-latest`为`mineru:maca-lmdeploy-latest`即可。
 
-其他详细使用命令可参考官方文档[Quick Usage - MinerU](https://opendatalab.github.io/MinerU/usage/quick_usage/#quick-model-source-configuration)
+执行该命令后,您将进入到Docker容器的交互式终端,您可以直接在容器内运行MinerU相关命令来使用MinerU的功能。
+您也可以直接通过替换`/bin/bash`为服务启动命令来启动MinerU服务,详细说明请参考[通过命令启动服务](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuihttp-clientserver)。
 
-### 离线使用
+## 4. 注意事项
 
-**所用模型为本地模型,需要设置环境变量和config配置文件**<br/>
-#### 下载模型到本地
-通过mineru交互式命令行工具进行下载,下载完后会自动更新mineru.json配置文件
-```bash
-mineru-models-download
-```
-也可以在[HuggingFace](http://www.huggingface.co.)或[ModelScope](https://www.modelscope.cn/home)找到所需模型源(PDF-Extract-Kit-1.0和MinerU2.5-2509-1.2B)进行下载,
-下载完成后,创建mineru.json文件,按如下进行修改
-```json
-{
-    "models-dir": {
-        "pipeline": "/path/pdf-extract-kit-1.0/",
-        "vlm": "/path/MinerU2.5-2509-1.2B"
-    },
-    "config_version": "1.3.0"
-}
-```
-path为本地模型的存储路径,其中models-dir为本地模型的路径,pipeline代表backend为pipeline时,所需要的模型路径,vlm代表backend为vlm-开头,所需要的模型路径
+不同环境下,MinerU对maca加速卡的支持情况如下表所示:
 
-#### 修改环境变量
+<table border="1">
+  <thead>
+    <tr>
+      <th rowspan="2" colspan="2">使用场景</th>
+      <th colspan="2">容器环境</th>
+    </tr>
+    <tr>
+      <th>vllm</th>
+      <th>lmdeploy</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td rowspan="4">命令行工具(mineru)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟡</td>
+      <td>🟡</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">fastapi服务(mineru-api)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟡</td>
+      <td>🟡</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">gradio界面(mineru-gradio)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟡</td>
+      <td>🟡</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">openai-server服务(mineru-openai-server)</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">数据并行 (--data-parallel-size/--dp)</td>
+      <td>🔴</td>
+      <td>🔴</td>
+    </tr>
+  </tbody>
+</table>
+  
+注:  
+🟢: 支持,运行较稳定,精度与Nvidia GPU基本一致  
+🟡: 支持但较不稳定,在某些场景下可能出现异常,或精度存在一定差异  
+🔴: 不支持,无法运行,或精度存在较大差异  
 
-```bash
-export MINERU_MODEL_SOURCE=local
-export MINERU_TOOLS_CONFIG_JSON=/path/mineru.json   //此环境变量为配置文件的路径
-```
-修改完成后即可正常使用<br/>
+>[!TIP]
+>MACA加速卡指定可用加速卡的方式与NVIDIA GPU类似,请参考[使用指定GPU设备](https://opendatalab.github.io/MinerU/zh/usage/advanced_cli_parameters/#cuda_visible_devices)章节说明。

+ 157 - 0
docs/zh/usage/acceleration_cards/THead.md

@@ -0,0 +1,157 @@
+## 1. 测试平台
+以下为本指南测试使用的平台信息,供参考:
+```
+os: Ubuntu 22.04   
+cpu: INTEL x86_64
+ppu: ZW810E  
+driver: 1.4.0
+docker: 26.1.4
+```
+
+## 2. 环境准备
+
+>[!NOTE]
+>ppu加速卡支持使用`vllm`或`lmdeploy`进行VLM模型推理加速。请根据实际需求选择安装和使用其中之一:
+
+### 2.1 使用 Dockerfile 构建镜像 (vllm)
+
+```bash
+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/ppu.Dockerfile
+docker build --network=host -t mineru:ppu-vllm-latest -f ppu.Dockerfile .
+``` 
+
+### 2.2 使用 Dockerfile 构建镜像 (lmdeploy)
+
+```bash
+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/ppu.Dockerfile
+# 将基础镜像从 vllm 切换为 lmdeploy
+sed -i '3s/^/# /' ppu.Dockerfile && sed -i '5s/^# //' ppu.Dockerfile
+docker build --network=host -t mineru:ppu-lmdeploy-latest -f ppu.Dockerfile .
+```
+
+
+## 3. 启动 Docker 容器
+
+```bash
+docker run --privileged=true \
+  --name mineru_docker \
+  --device=/dev/alixpu \
+  --device=/dev/alixpu_ctl \
+  --ipc=host \
+  --network=host \
+  --ulimit memlock=-1 \
+  --ulimit stack=67108864 \
+  --shm-size=500g \
+  -v /mnt:/mnt \
+  -v /datapool:/datapool \
+  -v /var/run/docker.sock:/var/run/docker.sock \
+  -e MINERU_MODEL_SOURCE=local \
+  -it mineru:ppu-vllm-latest \
+  /bin/bash
+```
+
+>[!TIP]
+> 请根据实际情况选择使用`vllm`或`lmdeploy`版本的镜像,如需使用lmdeploy,替换上述命令中的`mineru:ppu-vllm-latest`为`mineru:ppu-lmdeploy-latest`即可。
+
+执行该命令后,您将进入到Docker容器的交互式终端,您可以直接在容器内运行MinerU相关命令来使用MinerU的功能。
+您也可以直接通过替换`/bin/bash`为服务启动命令来启动MinerU服务,详细说明请参考[通过命令启动服务](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuihttp-clientserver)。
+
+## 4. 注意事项
+
+不同环境下,MinerU对ppu加速卡的支持情况如下表所示:
+
+<table border="1">
+  <thead>
+    <tr>
+      <th rowspan="2" colspan="2">使用场景</th>
+      <th colspan="2">容器环境</th>
+    </tr>
+    <tr>
+      <th>vllm</th>
+      <th>lmdeploy</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td rowspan="4">命令行工具(mineru)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">fastapi服务(mineru-api)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td rowspan="4">gradio界面(mineru-gradio)</td>
+      <td>pipeline</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-transformers</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-&lt;engine_name&gt;-engine</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td>vlm-http-client</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">openai-server服务(mineru-openai-server)</td>
+      <td>🟢</td>
+      <td>🟢</td>
+    </tr>
+    <tr>
+      <td colspan="2">数据并行 (--data-parallel-size/--dp)</td>
+      <td>🟡</td>
+      <td>🔴</td>
+    </tr>
+  </tbody>
+</table>
+
+注:  
+🟢: 支持,运行较稳定,精度与Nvidia GPU基本一致  
+🟡: 支持但较不稳定,在某些场景下可能出现异常,或精度存在一定差异  
+🔴: 不支持,无法运行,或精度存在较大差异  
+
+>[!TIP]
+>PPU加速卡指定可用加速卡的方式与NVIDIA GPU类似,请参考[使用指定GPU设备](https://opendatalab.github.io/MinerU/zh/usage/advanced_cli_parameters/#cuda_visible_devices)章节说明。

+ 7 - 6
docs/zh/usage/advanced_cli_parameters.md

@@ -1,8 +1,8 @@
 # 命令行参数进阶
 
-## vllm 加速参数优化
+## 推理引擎参数透传
 
-### 性能优化参数
+### vllm 加速参数优化
 > [!TIP]
 > 如果您已经可以正常使用vllm对vlm模型进行加速推理,但仍然希望进一步提升推理速度,可以尝试以下参数:
 > 
@@ -10,8 +10,9 @@
 
 ### 参数传递说明
 > [!TIP]
-> - 所有vllm官方支持的参数都可用通过命令行参数传递给 MinerU,包括以下命令:`mineru`、`mineru-vllm-server`、`mineru-gradio`、`mineru-api`
+> - 所有vllm/lmdeploy官方支持的参数都可用通过命令行参数传递给 MinerU,包括以下命令:`mineru`、`mineru-openai-server`、`mineru-gradio`、`mineru-api`
 > - 如果您想了解更多有关`vllm`的参数使用方法,请参考 [vllm官方文档](https://docs.vllm.ai/en/latest/cli/serve.html)
+> - 如果您想了解更多有关`lmdeploy`的参数使用方法,请参考 [lmdeploy官方文档](https://lmdeploy.readthedocs.io/en/latest/llm/api_server.html)
 
 ## GPU 设备选择与配置
 
@@ -21,7 +22,7 @@
 >   ```bash
 >   CUDA_VISIBLE_DEVICES=1 mineru -p <input_path> -o <output_path>
 >   ```
-> - 这种指定方式对所有的命令行调用都有效,包括 `mineru`、`mineru-vllm-server`、`mineru-gradio` 和 `mineru-api`,且对`pipeline`、`vlm`后端均适用。
+> - 这种指定方式对所有的命令行调用都有效,包括 `mineru`、`mineru-openai-server`、`mineru-gradio` 和 `mineru-api`,且对`pipeline`、`vlm`后端均适用。
 
 ### 常见设备配置示例
 > [!TIP]
@@ -39,9 +40,9 @@
 > [!TIP]
 > 以下是一些可能的使用场景:
 > 
-> - 如果您有多张显卡,需要指定卡0和卡1,并使用多卡并行来启动`vllm-server`,可以使用以下命令: 
+> - 如果您有多张显卡,需要指定卡0和卡1,并使用多卡并行来启动`openai-server`,可以使用以下命令: 
 >   ```bash
->   CUDA_VISIBLE_DEVICES=0,1 mineru-vllm-server --port 30000 --data-parallel-size 2
+>   CUDA_VISIBLE_DEVICES=0,1 mineru-openai-server --engine vllm --port 30000 --data-parallel-size 2
 >   ```
 >   
 > - 如果您有多张显卡,需要在卡0和卡1上启动两个`fastapi`服务,并分别监听不同的端口,可以使用以下命令: 

+ 1 - 1
docs/zh/usage/cli_tools.md

@@ -11,7 +11,7 @@ Options:
   -p, --path PATH                 输入文件路径或目录(必填)
   -o, --output PATH               输出目录(必填)
   -m, --method [auto|txt|ocr]     解析方法:auto(默认)、txt、ocr(仅用于 pipeline 后端)
-  -b, --backend [pipeline|vlm-transformers|vlm-vllm-engine|vlm-http-client]
+  -b, --backend [pipeline|vlm-transformers|vlm-vllm-engine|vlm-lmdeploy-engine|vlm-http-client]
                                   解析后端(默认为 pipeline)
   -l, --lang [ch|ch_server|ch_lite|en|korean|japan|chinese_cht|ta|te|ka|th|el|latin|arabic|east_slavic|cyrillic|devanagari]
                                   指定文档语言(可提升 OCR 准确率,仅用于 pipeline 后端)

+ 7 - 5
docs/zh/usage/index.md

@@ -20,11 +20,13 @@
     * [DataFlow](plugin/DataFlow.md)
     * [BISHENG](plugin/BISHENG.md)
     * [RagFlow](plugin/RagFlow.md)
-- 其他加速卡适配(由社区贡献)
-    * [昇腾 Ascend](acceleration_cards/Ascend.md) [#3233](https://github.com/opendatalab/MinerU/discussions/3233)
-    * [沐曦 METAX](acceleration_cards/METAX.md) [#3477](https://github.com/opendatalab/MinerU/pull/3477)
-    * [AMD](acceleration_cards/AMD.md)  [#3662](https://github.com/opendatalab/MinerU/discussions/3662)
-    * [太初元碁 Tecorigin](acceleration_cards/Tecorigin.md) [#3767](https://github.com/opendatalab/MinerU/pull/3767)
+- 其他加速卡适配(🚀官方支持/❤️社区贡献)
+    * [昇腾 Ascend](acceleration_cards/Ascend.md) 🚀
+    * [平头哥 T-Head](acceleration_cards/THead.md) 🚀
+    * [沐曦 METAX](acceleration_cards/METAX.md) 🚀
+    * [AMD](acceleration_cards/AMD.md)  [#3662](https://github.com/opendatalab/MinerU/discussions/3662) ️❤️
+    * [太初元碁 Tecorigin](acceleration_cards/Tecorigin.md) [#3767](https://github.com/opendatalab/MinerU/pull/3767) ❤️
+    * [寒武纪 Cambricon](acceleration_cards/Cambricon.md) [#4004](https://github.com/opendatalab/MinerU/discussions/4004) ❤️
 
 ## 开始使用
 

+ 11 - 5
docs/zh/usage/quick_usage.md

@@ -28,7 +28,7 @@ mineru -p <input_path> -o <output_path>
 mineru -p <input_path> -o <output_path> -b vlm-transformers
 ```
 > [!TIP]
-> vlm后端另外支持`vllm`加速,与`transformers`后端相比,`vllm`的加速比可达20~30倍,可以在[扩展模块安装指南](../quick_start/extension_modules.md)中查看支持`vllm`加速的完整包安装方法。
+> vlm后端另外支持`vllm`/`lmdeploy`加速,与`transformers`后端相比,推理速度可大幅提升。可以在[扩展模块安装指南](../quick_start/extension_modules.md)中查看支持`vllm`/`lmdeploy`加速的扩展包安装方法。
 
 如果需要通过自定义参数调整解析选项,您也可以在文档中查看更详细的[命令行工具使用说明](./cli_tools.md)。
 
@@ -47,6 +47,8 @@ mineru -p <input_path> -o <output_path> -b vlm-transformers
   mineru-gradio --server-name 0.0.0.0 --server-port 7860
   # 或使用 vlm-vllm-engine/pipeline 后端(需安装vllm环境)
   mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-vllm-engine true
+  # 或使用 vlm-lmdeploy-engine/pipeline 后端(需安装lmdeploy环境)
+  mineru-gradio --server-name 0.0.0.0 --server-port 7860 --enable-lmdeploy-engine true
   ```
   >[!TIP]
   > 
@@ -54,8 +56,12 @@ mineru -p <input_path> -o <output_path> -b vlm-transformers
 
 - 使用`http-client/server`方式调用:
   ```bash
-  # 启动vllm server(需要安装vllm环境)
-  mineru-vllm-server --port 30000
+  # 启动openai兼容服务器(需要安装vllm或lmdeploy环境)
+  mineru-openai-server
+  # 或指定vllm为推理引擎(需要安装vllm环境)
+  mineru-openai-server --engine vllm --port 30000
+  # 或指定lmdeploy为推理引擎(需要安装lmdeploy环境)
+  mineru-openai-server --engine lmdeploy --server-port 30000
   ``` 
   >[!TIP]
   >在另一个终端中通过http client连接vllm server(只需cpu与网络,不需要vllm环境)
@@ -64,8 +70,8 @@ mineru -p <input_path> -o <output_path> -b vlm-transformers
   > ```
 
 > [!NOTE]
-> 所有vllm官方支持的参数都可用通过命令行参数传递给 MinerU,包括以下命令:`mineru`、`mineru-vllm-server`、`mineru-gradio`、`mineru-api`,
-> 我们整理了一些`vllm`使用中的常用参数和使用方法,可以在文档[命令行进阶参数](./advanced_cli_parameters.md)中获取。
+> 所有`vllm/lmdeploy`官方支持的参数都可用通过命令行参数传递给 MinerU,包括以下命令:`mineru`、`mineru-openai-server`、`mineru-gradio`、`mineru-api`,
+> 我们整理了一些`vllm/lmdeploy`使用中的常用参数和使用方法,可以在文档[命令行进阶参数](./advanced_cli_parameters.md)中获取。
 
 ## 基于配置文件扩展 MinerU 功能
 

+ 7 - 5
mineru/backend/vlm/utils.py

@@ -12,14 +12,16 @@ def enable_custom_logits_processors() -> bool:
     import torch
     from vllm import __version__ as vllm_version
 
-    if not torch.cuda.is_available():
+    if torch.cuda.is_available():
+        major, minor = torch.cuda.get_device_capability()
+        # 正确计算Compute Capability
+        compute_capability = f"{major}.{minor}"
+    elif hasattr(torch, 'npu') and torch.npu.is_available():
+        compute_capability = "8.0"
+    else:
         logger.info("CUDA not available, disabling custom_logits_processors")
         return False
 
-    major, minor = torch.cuda.get_device_capability()
-    # 正确计算Compute Capability
-    compute_capability = f"{major}.{minor}"
-
     # 安全地处理环境变量
     vllm_use_v1_str = os.getenv('VLLM_USE_V1', "1")
     if vllm_use_v1_str.isdigit():

+ 18 - 15
mineru/backend/vlm/vlm_analyze.py

@@ -97,7 +97,6 @@ class ModelSingleton:
                 if backend == "vllm-engine":
                     try:
                         import vllm
-                        from mineru_vl_utils import MinerULogitsProcessor
                     except ImportError:
                         raise ImportError("Please install vllm to use the vllm-engine backend.")
                     if "gpu_memory_utilization" not in kwargs:
@@ -105,6 +104,7 @@ class ModelSingleton:
                     if "model" not in kwargs:
                         kwargs["model"] = model_path
                     if enable_custom_logits_processors() and ("logits_processors" not in kwargs):
+                        from mineru_vl_utils import MinerULogitsProcessor
                         kwargs["logits_processors"] = [MinerULogitsProcessor]
                     # 使用kwargs为 vllm初始化参数
                     vllm_llm = vllm.LLM(**kwargs)
@@ -112,7 +112,6 @@ class ModelSingleton:
                     try:
                         from vllm.engine.arg_utils import AsyncEngineArgs
                         from vllm.v1.engine.async_llm import AsyncLLM
-                        from mineru_vl_utils import MinerULogitsProcessor
                     except ImportError:
                         raise ImportError("Please install vllm to use the vllm-async-engine backend.")
                     if "gpu_memory_utilization" not in kwargs:
@@ -120,6 +119,7 @@ class ModelSingleton:
                     if "model" not in kwargs:
                         kwargs["model"] = model_path
                     if enable_custom_logits_processors() and ("logits_processors" not in kwargs):
+                        from mineru_vl_utils import MinerULogitsProcessor
                         kwargs["logits_processors"] = [MinerULogitsProcessor]
                     # 使用kwargs为 vllm初始化参数
                     vllm_async_llm = AsyncLLM.from_engine_args(AsyncEngineArgs(**kwargs))
@@ -132,19 +132,22 @@ class ModelSingleton:
                     if "cache_max_entry_count" not in kwargs:
                         kwargs["cache_max_entry_count"] = 0.5
 
-                    if "lmdeploy_device" in kwargs:
-                        device_type = kwargs.pop("lmdeploy_device")
-                        if device_type not in ["cuda", "ascend", "maca", "camb"]:
-                            raise ValueError(f"Unsupported lmdeploy device type: {device_type}")
-                    else:
-                        device_type = "cuda"
-
-                    if "lmdeploy_backend" in kwargs:
-                        lm_backend = kwargs.pop("lmdeploy_backend")
-                        if lm_backend not in ["pytorch", "turbomind"]:
-                            raise ValueError(f"Unsupported lmdeploy backend: {lm_backend}")
-                    else:
-                        lm_backend = set_lmdeploy_backend(device_type)
+                    device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", "")
+                    if device_type == "":
+                        if "lmdeploy_device" in kwargs:
+                            device_type = kwargs.pop("lmdeploy_device")
+                            if device_type not in ["cuda", "ascend", "maca", "camb"]:
+                                raise ValueError(f"Unsupported lmdeploy device type: {device_type}")
+                        else:
+                            device_type = "cuda"
+                    lm_backend = os.getenv("MINERU_LMDEPLOY_BACKEND", "")
+                    if lm_backend == "":
+                        if "lmdeploy_backend" in kwargs:
+                            lm_backend = kwargs.pop("lmdeploy_backend")
+                            if lm_backend not in ["pytorch", "turbomind"]:
+                                raise ValueError(f"Unsupported lmdeploy backend: {lm_backend}")
+                        else:
+                            lm_backend = set_lmdeploy_backend(device_type)
                     logger.info(f"lmdeploy device is: {device_type}, lmdeploy backend is: {lm_backend}")
 
                     if lm_backend == "pytorch":

+ 5 - 0
mineru/cli/common.py

@@ -18,6 +18,11 @@ from mineru.backend.vlm.vlm_analyze import doc_analyze as vlm_doc_analyze
 from mineru.backend.vlm.vlm_analyze import aio_doc_analyze as aio_vlm_doc_analyze
 from mineru.utils.pdf_page_id import get_end_page_id
 
+if os.getenv("MINERU_LMDEPLOY_DEVICE", "") == "maca":
+    import torch
+    torch.backends.cudnn.enabled = False
+
+
 pdf_suffixes = ["pdf"]
 image_suffixes = ["png", "jpeg", "jp2", "webp", "gif", "bmp", "jpg", "tiff"]
 

+ 51 - 0
mineru/cli/vlm_server.py

@@ -1,3 +1,7 @@
+import click
+import sys
+
+from loguru import logger
 
 
 def vllm_server():
@@ -8,3 +12,50 @@ def vllm_server():
 def lmdeploy_server():
     from mineru.model.vlm.lmdeploy_server import main
     main()
+
+
+@click.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True))
+@click.option(
+    '-e',
+    '--engine',
+    'inference_engine',
+    type=click.Choice(['auto', 'vllm', 'lmdeploy']),
+    default='auto',
+    help='Select the inference engine used to accelerate VLM inference, default is "auto".',
+)
+@click.pass_context
+def openai_server(ctx, inference_engine):
+    sys.argv = [sys.argv[0]] + ctx.args
+    if inference_engine == 'auto':
+        try:
+            import vllm
+            inference_engine = 'vllm'
+            logger.info("Using vLLM as the inference engine for VLM server.")
+        except ImportError:
+            logger.info("vLLM not found, attempting to use LMDeploy as the inference engine for VLM server.")
+            try:
+                import lmdeploy
+                inference_engine = 'lmdeploy'
+            # Success message moved after successful import
+                logger.info("Using LMDeploy as the inference engine for VLM server.")
+            except ImportError:
+                logger.error("Neither vLLM nor LMDeploy is installed. Please install at least one of them.")
+                sys.exit(1)
+
+    if inference_engine == 'vllm':
+        try:
+            import vllm
+        except ImportError:
+            logger.error("vLLM is not installed. Please install vLLM or choose LMDeploy as the inference engine.")
+            sys.exit(1)
+        vllm_server()
+    elif inference_engine == 'lmdeploy':
+        try:
+            import lmdeploy
+        except ImportError:
+            logger.error("LMDeploy is not installed. Please install LMDeploy or choose vLLM as the inference engine.")
+            sys.exit(1)
+        lmdeploy_server()
+
+if __name__ == "__main__":
+    openai_server()

+ 2 - 0
mineru/model/vlm/lmdeploy_server.py

@@ -53,10 +53,12 @@ def main():
     if not has_log_level_arg:
         args.extend(["--log-level", "ERROR"])
 
+    device_type = os.getenv("MINERU_LMDEPLOY_DEVICE", device_type)
     if device_type == "":
         device_type = "cuda"
     elif device_type not in ["cuda", "ascend", "maca", "camb"]:
         raise ValueError(f"Unsupported lmdeploy device type: {device_type}")
+    lm_backend = os.getenv("MINERU_LMDEPLOY_BACKEND", lm_backend)
     if lm_backend == "":
         lm_backend = set_lmdeploy_backend(device_type)
     elif lm_backend not in ["pytorch", "turbomind"]:

+ 7 - 5
pyproject.toml

@@ -39,7 +39,8 @@ dependencies = [
     "openai>=1.70.0,<3",
     "beautifulsoup4>=4.13.5,<5",
     "magika>=0.6.2,<1.1.0",
-    "mineru-vl-utils>=0.1.15,<1",
+    "mineru-vl-utils>=0.1.17,<1",
+    "qwen-vl-utils>=0.0.14,<1",
 ]
 
 [project.optional-dependencies]
@@ -52,15 +53,14 @@ test = [
 ]
 vlm = [
     "torch>=2.6.0,<3",
-    "transformers>=4.51.1,<5.0.0",
+    "transformers>=4.51.1,!=4.57.2,<5.0.0",
     "accelerate>=1.5.1",
 ]
 vllm = [
     "vllm>=0.10.1.1,<0.12",
 ]
 lmdeploy = [
-    "lmdeploy>=0.10.2,<0.11",
-    "qwen_vl_utils>=0.0.14,<0.1",
+    "lmdeploy>=0.10.2,<0.12",
 ]
 mlx = [
     "mlx-vlm>=0.3.3,<0.4",
@@ -98,7 +98,8 @@ core = [
 ]
 all = [
     "mineru[core]",
-    "mineru[vllm]",
+    "mineru[vllm] ; sys_platform == 'linux'",
+    "mineru[lmdeploy] ; sys_platform == 'windows'",
 ]
 
 [project.urls]
@@ -111,6 +112,7 @@ issues = "https://github.com/opendatalab/MinerU/issues"
 mineru = "mineru.cli:client.main"
 mineru-vllm-server = "mineru.cli.vlm_server:vllm_server"
 mineru-lmdeploy-server = "mineru.cli.vlm_server:lmdeploy_server"
+mineru-openai-server = "mineru.cli.vlm_server:openai_server"
 mineru-models-download = "mineru.cli.models_download:download_models"
 mineru-api = "mineru.cli.fast_api:main"
 mineru-gradio = "mineru.cli.gradio_app:main"