Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
fix: update Ascend.md and cli_tools.md for improved clarity on environment setup and backend options
myhloli281c965213e7
diff --git a/docker/china/npu.Dockerfile b/docker/china/npu.Dockerfileindex a4d0ffc9..65eedae7 100644--- a/docker/china/npu.Dockerfile+++ b/docker/china/npu.Dockerfile@@ -1,5 +1,12 @@+# 基础镜像配置# 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+FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ascend:mineru-a2 AS lmdeploy+# Base image containing the vLLM inference environment, requiring ARM(AArch64) CPU + Ascend NPU.+FROM quay.io/ascend/vllm-ascend:v0.11.0rc1 AS vllm++# 默认使用 lmdeploy+ARG INFERENCE_ENGINE=lmdeploy+FROM ${INFERENCE_ENGINE} AS final# Install libgl for opencv support & Noto fonts for Chinese charactersRUN apt-get update && \@@ -7,7 +14,7 @@ RUN apt-get update && \fonts-noto-core \fonts-noto-cjk \fontconfig \- libgl1 && \+ libgl1 \libglib2.0-0 && \fc-cache -fv && \apt-get clean && \diff --git a/docs/en/usage/cli_tools.md b/docs/en/usage/cli_tools.mdindex ccffbc43..c8432117 100644--- a/docs/en/usage/cli_tools.md+++ b/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)diff --git a/docs/zh/usage/acceleration_cards/Ascend.md b/docs/zh/usage/acceleration_cards/Ascend.mdindex 10352efc..48e0622d 100644--- a/docs/zh/usage/acceleration_cards/Ascend.md+++ b/docs/zh/usage/acceleration_cards/Ascend.md@@ -1,64 +1,60 @@-#### 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-```-↑这些不知道哪些好使,或者有没有好使的+Ascend加速卡支持使用`lmdeploy`或`vllm`进行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 使用 lmdeploy++#### 使用 Dockerfile 构建镜像++```bash+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile+docker build --build-arg INFERENCE_ENGINE=lmdeploy -t mineru: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"++### 2.2 使用 vllm++#### 使用 Dockerfile 构建镜像++```bash+wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docker/china/npu.Dockerfile+docker build --build-arg INFERENCE_ENGINE=vllm -t mineru:latest -f npu.Dockerfile .+```++## 3. 启动 Docker 容器++```bash+docker run -u root --name mineru_docker --privileged=true \+ -p 30000:30000 -p 7860:7860 -p 8000:8000 \+ --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 \+ -itd mineru:latest \+ /bin/bash```-4 其他-torch / torch_npu 2.5.1-pip install "numpy<2.0" 2.0和昇腾不兼容-export MINERU_MODEL_SOURCE=modelscope++执行该命令后,您将进入到Docker容器的交互式终端,并映射了一些端口用于可能会使用的服务,您可以直接在容器内运行MinerU相关命令来使用MinerU的功能。+您也可以直接通过替换`/bin/bash`为服务启动命令来启动MinerU服务,详细说明请参考[通过命令启动服务](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuihttp-clientserver)。\ No newline at end of filediff --git a/docs/zh/usage/cli_tools.md b/docs/zh/usage/cli_tools.mdindex 218da1e2..9c3b6aa6 100644--- a/docs/zh/usage/cli_tools.md+++ b/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 后端)diff --git a/docs/zh/usage/index.md b/docs/zh/usage/index.mdindex 8940bb39..ca44611e 100644--- a/docs/zh/usage/index.md+++ b/docs/zh/usage/index.md@@ -21,7 +21,7 @@* [BISHENG](plugin/BISHENG.md)* [RagFlow](plugin/RagFlow.md)- 其他加速卡适配(由社区贡献)- * [昇腾 Ascend](acceleration_cards/Ascend.md) [#3233](https://github.com/opendatalab/MinerU/discussions/3233)+ * [昇腾 Ascend](acceleration_cards/Ascend.md)* [沐曦 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)