Ingest multi-column PDFs with equations and complex tables — MinerU's core strength.
from mineru.pipe.pdf_pipe import UnitPDFPipeline
from mineru.config import MinerUConfig
# 1. Configure — backend auto-selects GPU if available
cfg = MinerUConfig(
parse_method="auto", # txt | ocr | auto
formula_enable=True, # UniMERNet → LaTeX
table_enable=True, # structured HTML table output
lang="en" # or "zh", "ja", "auto"
)
# 2. Parse single paper
pipe = UnitPDFPipeline("attention_is_all_you_need.pdf", cfg)
md_content, images, layout_json = pipe.pipe_parse()
# 3. Formulas come out as LaTeX inline
print(md_content[:500])
# → "...the attention function $\text{Attention}(Q,K,V) =
# \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V$..."
Expected output (excerpt)
## 3.2 Attention
An attention function maps a query and key-value pairs to an output:
$$\text{Attention}(Q,K,V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V$$
| Model | EN-DE BLEU | EN-FR BLEU | Training cost (FLOPs) |
|-------|-----------|-----------|----------------------|
| Transformer (big) | **28.4** | **41.0** | 3.3×10¹⁸ |