Document parsing with MinerU 2.5 and OpenVINO
MinerU 2.5 is a state-of-the-art document parsing engine maintained by OpenDataLab. Its 2.5 generation uses a single 1.2 B parameter vision–language model — [opendatalab/MinerU2.5-Pro-2604-1.2B](https://huggingface.co/opendatalab
Content
Document parsing with MinerU 2.5 and OpenVINO
MinerU 2.5 is a state-of-the-art document parsing engine maintained by OpenDataLab. Its 2.5 generation uses a single 1.2 B parameter vision–language model — opendatalab/MinerU2.5-Pro-2604-1.2B — that converts page images into structured Markdown / JSON in two prompted steps:
- Layout detection — the whole page is sent to the model with the prompt
Layout Detection:. The model emits special<|box_start|>… <|box_end|><|ref_start|>type<|ref_end|>tokens that describe every region's bounding box and type (text, title, table, formula, image, chart, …). - Per-region content recognition — every region is cropped and sent back with a region-specific prompt (
Text Recognition:,Table Recognition:,Formula Recognition:,Image Analysis:).
A small post-processing layer fixes equation delimiters, normalises tables to HTML/OTSL, merges truncated paragraphs and finally renders Markdown via json2md.
The model is a Qwen2-VL architecture under the hood, so it can be exported to OpenVINO IR as shown in the [VLM chatbot](../vlm-chatbot/vlm-chatbot-generate-api.ipynb) notebook. In this tutorial we:
- convert and INT4 weight-compress
MinerU2.5-Pro-2604-1.2Bwith Optimum Intel, - run inference with OpenVINO GenAI's
VLMPipeline, - drive the MinerU two-step pipeline through a small
OVMinerUClientwrapper (in [ov_mineru_helper.py](ov_mineru_helper.py)) that reuses the official post-processing utilities frommineru-vl-utils, - and expose the whole thing as a tiny Gradio document-to-Markdown demo.
Notebook contents
The tutorial consists of the following steps:
- Install requirements
- Convert and optimize the model with
optimum-cli - Build an
OVMinerUClientaroundopenvino_genai.VLMPipeline - Parse a sample document image and visualise the detected layout
- Convert a multi-page PDF to Markdown
- Launch an interactive Gradio demo
The demo accepts both PDF files (rasterised on the fly with pypdfium2) and standalone document images, and renders the Markdown side by side with the source.
Installation instructions
This is a self-contained example that relies solely on its own code.</br> We recommend running the notebook in a virtual environment. You only need a Jupyter server to start. For details, please refer to [Installation Guide](../../README.md).
Source and license
- Source
- Intel OpenVINO Notebooks
- Original
- openvinotoolkit/openvino_notebooks/notebooks/mineru2.5
- License
- Apache-2.0