1.系统环境配置
(1)检查CUDA环境和GPU状态
需要CUDA11.8或以上
nvcc --version
sudo apt install nvidia-cuda-toolkit

(显示的CUDA版本为最高版本)
nvidia-smi

python --version
conda create -n mineru python=3.12.4conda activate mineru



2.安装MinerU
(1)安装包管理工具
pip install uv

uv pip install -U "mineru[core]" -i https://mirrors.aliyun.com/pypi/simple


查看Ubuntu CUDA版本的方法
nvcc -V

CUDA 12.1 向下兼容 12.0)。以下是适配的安装命令:pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu121
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu126
Installing previous versions of PyTorch
We’d prefer you install the latest version, but old binaries and installation instructions are provided below for your convenience.
Commands for Versions >= 1.0.0
Linux and Windows
# ROCM 6.4 (Linux only)
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/rocm6.4
# CUDA 12.6
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu126
# CUDA 12.8
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
# CUDA 12.9
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu129
# CPU only
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cpu
mineru-models-download --model_type all

输入modelscope

4.功能测试
pdf输入地址:/home/mac/wendang/pdfs
解析输出地址:/home/mac/wendang/test_output
(1)pipeline模式(速度快)
测试单个pdf文件解析(n卡可GPU加速)通过表格,公式,排版等小模型分开识别
cd /home/mac/wendang/mineru -p ./pdfs/demo1.pdf -o test_output/ --backend pipeline device cuda

(2)vlm模式(精度高,速度慢)
通过视觉模型进行识别
mineru -p ./pdfs/demo1.pdf -o test_output/ --backend vlm-transformers --device cuda
mineru -p ./pdfs -o test_output/ --backend pipeline batch-size 8
5.启动web界面
conda activate mineru
# 启动web服务界面mineru-gradio --server-name 0.0.0.0 --server-port 7860
https://aicarrier.feishu.cn/wiki/TzBcwXurRiuQZkk17licytSTnBc