Add 8 new document processing engines and update benchmarks#5
Merged
Conversation
Replace the placeholder MinerU engine with a working implementation using the magic-pdf PymuDocDataset API. The adapter auto-classifies PDFs as text or scanned, runs layout analysis + OCR via doc_analyze, and returns markdown or JSON content. Handles version differences across magic-pdf releases for import paths and PyTorch 2.6+ weights_only compatibility. Benchmark results on synthetic PDFs (CPU, no GPU): - Avg CER: 0.0118, Avg WER: 0.0804 - Avg time: ~24.7s per document (CPU-only, first run includes model load) https://claude.ai/code/session_01DoMETpAmkAQJ8TPCdsgrTt
…4 engines Add MarkerLocalEngine adapter using marker-pdf for local PDF conversion. Update SuryaEngine for Surya v0.17 predictor-based API. Fix MinerU dill/PyTorch safe globals compatibility. Benchmark all engines side-by-side: PyMuPDF (7.5ms, 0 CER), Surya (12.1s, 0.014 CER), Marker Local (14.0s, 0.019 CER), MinerU (16.5s, 0.012 CER). https://claude.ai/code/session_01DoMETpAmkAQJ8TPCdsgrTt
Add Docling, EasyOCR, PaddleOCR, Tesseract, and Unstructured to the benchmark suite (9 engines total, 8 producing results). Fix PaddleOCR adapter for v3 API (predict() instead of ocr()). Add comprehensive measured benchmark results section to docs/benchmarks.md with summary table and per-document breakdowns. Results on CPU (digital PDFs): PyMuPDF 8ms/0 CER, Tesseract 1.2s/0 CER, Docling 2.6s/0.017 CER, MinerU 17.6s/0.012 CER, Surya 33.1s/0.014 CER, EasyOCR 40.7s/0.019 CER, Marker 40.8s/0.019 CER. https://claude.ai/code/session_01DoMETpAmkAQJ8TPCdsgrTt
…chmarks Fix Nougat engine to properly load decoder weights with newer transformers (key remapping + config patch for correct decoder layer count). Add per-engine timeout and BENCH_SKIP support to benchmark.py. Update benchmark results with all 10 local engines including PaddleOCR (now working with v2.10.0) and Nougat (academic-only, empty output on simple text PDFs). https://claude.ai/code/session_01DoMETpAmkAQJ8TPCdsgrTt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for 8 new document processing engines (MinerU, Marker Local, Surya, Docling, PaddleOCR, Tesseract, EasyOCR, Nougat) and significantly expands the benchmark suite to compare performance across all engines.
Key Changes
New Engine Implementations
mineru_engine.py): Adds support for magic-pdf with intelligent PDF classification (text vs. OCR mode), page range support, and JSON/Markdown output formats. Includes lazy loading of dependencies and PyTorch weight loading compatibility fixes.marker_local_engine.py): Implements local Marker PDF conversion with support for multiple document formats (PDF, DOCX, images, etc.) and configurable OCR forcing.surya_engine.py): Updates to use the v0.17+ predictor-based API with improved image loading and OCR pipeline.paddleocr_engine.py): Adds compatibility for both PaddleOCR 2.x and 3.x APIs with language support.nougat_engine.py): Significant updates to handle model configuration mismatches, decoder layer detection from HuggingFace configs, and state dict shape compatibility for different transformer versions.Benchmark Infrastructure
Notable Implementation Details
Testing
Added comprehensive test coverage for new engines including:
https://claude.ai/code/session_01DoMETpAmkAQJ8TPCdsgrTt