mineru2.5无法用demo.py文件运行
Closed this issue · 2 comments
🔎 Search before asking | 提交之前请先搜索
- I have searched the MinerU Readme and found no similar bug report.
- I have searched the MinerU Issues and found no similar bug report.
- I have searched the MinerU Discussions and found no similar bug report.
🤖 Consult the online AI assistant for assistance | 在线 AI 助手咨询
- I have consulted the online AI assistant but was unable to obtain a solution to the issue.
Description of the bug | 错误描述
mineru2.5无法用demo.py文件运行,demo.py只能运行之前版本的mineru。
How to reproduce the bug | 如何复现
python demo/demo.py
Operating System Mode | 操作系统类型
Linux
Operating System Version| 操作系统版本
Ubuntu 22.04
Python version | Python 版本
3.13
Software version | 软件版本 (mineru --version)
2.0.x
Device mode | 设备模式
cuda
Hi @ChineseWTAO! I'm Dosu and I’m helping the MinerU team.
MinerU 2.5 对 demo.py 的兼容性发生了重大变化,主要原因有:
-
VLM 推理代码已拆分为独立包 mineru-vl-utils,需要手动安装:详情
pip install "mineru-vl-utils[transformers]>=0.1.7,<1" -
transformers 版本要求提升,必须 >=4.56.0 且 <5.0.0,否则会报 dtype 参数错误:详情
pip install 'transformers>=4.56.0,<5.0.0' -
demo.py 的后端调用逻辑有变化:VLM 模型(如 vlm-transformers/vlm-vllm-engine)只支持单个 PDF bytes 输入,不能像 pipeline 模式那样批量处理 PDF 列表。你需要根据 backend 参数分支处理输入,不能直接传列表给 VLM 后端。代码参考
-
VLM 后端依赖 mineru-vl-utils 包,pipeline 后端不需要。确保环境变量、依赖和 backend 参数正确,否则会报模块缺失或推理失败。
迁移 checklist:
- 升级 MinerU 到 2.5 及以上。
- 安装 mineru-vl-utils 和 transformers 新版本。
- 检查 demo.py 是否根据 backend 参数分支处理输入(pipeline 支持批量,vlm-xxx 只支持单个 PDF)。
- 如需 VLM 模型推理,backend 参数需设为
vlm-transformers或vlm-vllm-engine,并确保 CUDA 环境和显存充足。 - 如遇 dtype 报错,确认 transformers 版本是否正确。
参考代码与 PR:
如依然无法运行,建议贴出报错信息和 pip freeze 结果,进一步定位依赖冲突。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
demo.py需要更新到最新