Feat/add ingestion scaffold - #2
Merged
Merged
Conversation
- Added `Backend` protocol to define the interface for processing sources into documents. - Introduced `Source`, `Block`, and `Document` models in `schema.py` for structured data representation. - Updated `__init__.py` to re-export new classes as part of the public API. - Created tests for schema properties and document functionality to ensure data integrity and correctness.
- Added `pydantic` version `>=2.10` to `pyproject.toml` for data validation. - Updated `uv.lock` to include `pydantic` and `annotated-types` with their respective versions and dependencies.
- Added Pydantic v2 schemas: Source, Block, Document. - Introduced Backend Protocol abstraction. - Implemented Markdown and JSON export functionality for Document.
- Added `_device.py` for auto-detecting the best available device (CPU, CUDA, MPS) based on environment variables and PyTorch availability. - Introduced `_hashing.py` with a `sha256_file` function to compute SHA-256 hashes of files. - Created `cli.py` for command-line interface to parse documents with support for different output formats and backends. - Implemented `docling.py` backend for document processing, integrating with the Docling library. - Added tests for CLI commands and Docling backend functionality, ensuring robust document parsing and output handling. - Included fixture generation for testing with sample PDF documents.
- Introduced a new PDF file `simple_text.pdf` in the fixtures directory to support testing of document parsing and processing functionalities.
- Added `typer` as a dependency in `pyproject.toml` for command-line interface support. - Introduced optional dependency group for `docling` with version `>=2.0`. - Defined a new script entry point for `bigos.cli:app`. - Updated `uv.lock` with new package dependencies including `accelerate`, `annotated-doc`, and others. - Modified `pytest` command in CI workflow to exclude slow tests. - Added `reportlab` to development dependencies for PDF generation support. - Updated mypy configuration to ignore missing imports for specific modules.
- Added new entries to CHANGELOG for DoclingBackend integration, CLI enhancements, cross-platform device detection, and generated test fixtures. - Expanded README with a quick example for using the CLI and updated supported formats section to include PDF via Docling.
- Introduced `sanity_check.py` script to process all PDFs in a directory and print processing statistics. - Implemented `DiskCache` class for caching parsed documents, improving performance by reducing redundant processing. - Updated `DoclingBackend` to support caching of documents based on SHA-256 and backend version. - Added tests for cache functionality and performance improvements when using cached documents.
- Updated CHANGELOG to include new features: DiskCache, CLI flags for caching, and the addition of the sanity check script. - Expanded README with instructions for using the sanity check script on local documents. - Created a new README in the data directory to guide users on managing document samples for sanity checks.
- Added `diskcache` as a new dependency in `pyproject.toml` and `uv.lock` for improved caching functionality. - Updated `.gitignore` to exclude all files in the `data` directory except for `README.md` and `.gitkeep`, streamlining document sample management.
- Introduced a new CLI command `eval` for evaluating document processing benchmarks using OmniDocBench. - Implemented evaluation metrics including Character Error Rate (CER) and Tree Edit Distance Similarity (TEDS) in `metrics.py`. - Added support for generating evaluation reports in Markdown and JSON formats. - Created new modules for OmniDocBench evaluation and metrics, enhancing the overall evaluation framework. - Added tests for evaluation metrics and OmniDocBench functionality to ensure accuracy and reliability.
- Created a new documentation file for OmniDocBench evaluation, detailing the benchmark, metrics, and caveats. - Added baseline results for the `academic_paper` and `tables` subsets in both JSON and Markdown formats, including per-sample metrics and aggregate statistics. - Introduced a `.gitkeep` file in the results directory to maintain structure.
- Added new dependencies in `pyproject.toml` for evaluation, including `datasets`, `huggingface-hub`, `jiwer`, `rapidfuzz`, `apted`, and `pillow`. - Updated `uv.lock` with new packages `aiohappyeyeballs` and `aiohttp`, along with their respective dependencies and wheel files. - Enhanced module imports to include new evaluation-related packages, improving the overall functionality of the project.
- Added evaluation metrics including character error rate, TEDS, and edit distance to the evaluation harness. - Integrated OmniDocBench v1.5 via HuggingFace dataset repo and updated CLI to support `bigos eval --benchmark=omnidocbench`. - Documented evaluation setup and baseline results for `tables` and `academic_paper` subsets in README and CHANGELOG.
- Added new command-line options for evaluation, including `--dump-dir` for diagnostic JSON dumps and `--gt-strategy` to select between legacy and json2md ground-truth assembly. - Updated evaluation logic to incorporate the new options and improved error handling for ground-truth strategy validation. - Enhanced metrics calculations by including mean NED and mean length ratio in the evaluation report. - Refactored text metrics in `metrics.py` to improve clarity and added normalization functions for better comparison of predicted and ground-truth text.
- Introduced multiple diagnostic scripts to analyze and visualize data from OmniDocBench, including statistics on length distributions, sample previews, and ground truth extraction logic. - Implemented a deep-dive script for detailed comparisons of predicted and ground truth outputs. - Added functionality to search for ground truth extraction logic in the reference repository and compare legacy extraction methods with new approaches. - Enhanced the sanity check script to include Polish character detection and improved output reporting for processed documents. - Updated evaluation metrics tests to cover new functionalities and ensure accuracy in diagnostic outputs.
- Added `eval/results/` to .gitignore to exclude evaluation result files from version control. - Updated CHANGELOG with new evaluation features, including ground-truth markdown rebuilding and per-category metric breakdown. - Enhanced README with instructions for running evaluations and inspecting individual sample results. - Introduced new documentation file `metrics-explained.md` to clarify evaluation metrics used in OmniDocBench.
- Introduced `enable_vlm` option in CLI for using the Granite-Docling VLM pipeline, allowing for improved handling of STEM PDFs and LaTeX output. - Updated `DoclingBackend` to support VLM processing, including necessary adjustments to the document converter and versioning. - Enhanced tests to verify VLM functionality and ensure stability with simple PDFs. - Updated documentation to reflect new VLM capabilities and usage instructions.
- Introduced `01_docling_vlm_api.py` to discover and log the VLM pipeline API in the installed Docling version, including module inspection and class/function signatures. - Added `02_vlm_smoke_test.py` to perform a smoke test on the VLM pipeline using local PDF and image inputs, logging conversion results and detected formula-like items. - Enhanced output handling by writing results to markdown files for easier inspection.
- Introduced three new documentation files: `diagnosis-2025.md`, `docling-vlm-api.md`, and `json2md-reference.md` to enhance understanding of evaluation metrics, VLM pipeline API, and JSON to Markdown conversion processes. - Updated `omnidocbench.md` to reference the new documentation files, improving navigation and accessibility of evaluation resources. - The new documents provide detailed insights into the evaluation process, API usage, and conversion logic, supporting better analysis and understanding of the OmniDocBench framework.
- Added `enable_vlm` option in `DoclingBackend` for formula-friendly parsing with the new `granite_docling` preset. - Introduced CLI commands `bigos parse --vlm` and `bigos eval --vlm` for VLM processing. - Updated `CHANGELOG.md` to reflect new features and changes related to VLM integration. - Enhanced `README.md` with instructions and comparison metrics for the academic paper subset using VLM, showcasing performance improvements.
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.
Context
On the OmniDocBench
academic_papersubset, the defaultDocumentConverter(StandardPdfPipeline) did not emit formula blocks (n_formulas_pred = 0) despite LaTeX-rich ground truth. Docling exposes a separate VLM path (VlmPipeline+granite_doclingpreset), which must be configured explicitly.Goals
versionsuffix+vlmwhen VLM is enabled).Technical changes
DoclingBackend:enable_vlm: bool = False. WhenTrue:VlmPipeline,VlmPipelineOptions,VlmConvertOptions.from_preset("granite_docling"), withPdfFormatOptionfor PDF andImageFormatOptionfor images (avoids deprecation when processing images).TextItemwith labelFORMULA; heuristic for LaTeX-like text when the model returns formulas as plain text.bigos parseandbigos eval—--vlm/--no-vlm(Docling backend only).scripts/discover/01_docling_vlm_api.py,02_vlm_smoke_test.py; outputs undereval/results/discovery/.docs/eval/docling-vlm-api.md; updates toREADME.md,CHANGELOG.md,docs/eval/omnidocbench.md.baseline-omnidocbench-academic_paper-v4.{md,json}, dumps ineval/results/dumps/academic-v4/,eval/results/comparison-v3-vs-v4-academic.md.Results (summary)
VLM materially improves formula coverage and headline text metrics; mean
formula_edit_diststays high due to LaTeX formatting differences vs GT. Details and qualitative notes:eval/results/comparison-v3-vs-v4-academic.md.Testing
uv run ruff check ./ruff format --checkuv run mypy src/uv run pytest(includingslow, e.g. VLM smoke on a tiny PDF)Compatibility
--vlmis passed.backend.versionwith VLM — no mixing cached parses between standard and VLM runs.