Skip to content

ocr: add Fugu OCR recipes (fugu-ocr.py on GPU, fugu-ocr-cpu.py on CPU) - #223

Open
fugu-ai wants to merge 1 commit into
davanstrien:mainfrom
fugu-ai:add-fugu-ocr
Open

fugu-ai wants to merge 1 commit into
davanstrien:mainfrom
fugu-ai:add-fugu-ocr

Conversation

@fugu-ai

@fugu-ai fugu-ai commented Dec 3, 2026

Copy link
Copy Markdown

Adds two recipes for Fugu OCR, a small OCR for financial and business documents:

Script Reader Default flavor Measured on HF Jobs
fugu-ocr.py Full reader (line reader 8M + cell reader 7M parameters) l4x1 6.1 pages/s, about $36 per million pages
fugu-ocr-cpu.py Small reader (1M parameters, ONNX Runtime, no PyTorch) cpu-upgrade 2–3 pages/s on dense report pages, 5–6.5 on manuals; about $3–4 per million report pages

Measured on 3 December 2026 over the 4,999 page images of docling-project/DocLayNet-v1.2 (test split), 0 errors; the CPU figure from six cpu-upgrade jobs side by side.

What is different from most recipes here

  • Output is resumable parquet parts under data/shard-*/ with id, page, markdown (plain text; a table row's label and figures on one line), fugu_ocr (the page's JSON: line boxes in PDF points, confidences, table rows) and error, like the -saturate.py recipes. Re-running the same command skips finished parts.
  • --shard i/N for running N jobs side by side; each job streams only its own files of the dataset (falls back to every N-th row, with a log line, when the dataset has fewer files than jobs).
  • --pdfs reads a dataset repo of PDF files. A page's own text is taken where a spot check against its picture agrees, and only its pictures and pages without usable text are OCR'd (--ocr-only turns this off). --charts (beta) adds the values of charts drawn in the PDF.
  • Each part's log line gives fetch, wait, read and upload times.
  • fugu-ocr.py exits with a message when there is no GPU, pointing to fugu-ocr-cpu.py.

Licence: the model weights are PolyForm Internal Use 1.0.0 or PolyForm Noncommercial 1.0.0 (free to run inside your own organisation, including commercially; not open source). Stated in the README row, models.json and the script docstrings.

Checks run: both scripts on HF Jobs (the final version smoke-tested on cpu-upgrade over uv-scripts/ocr-demo, 7 pages, 0 errors; earlier versions (l4x1, a10g-small, a10g-large, cpu-upgrade ×6) over the DocLayNet test split and on uv-scripts/ocr-demo; python3 tools/build-catalog.py --verify-models passes with no command warnings. Folder changes are additive. models.json lists both as experimental.

The recipes are also kept in the project repo: https://github.com/fugu-ai/fugu-ocr/tree/main/deploy/hf_jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant