You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Datalab's Surya OCR 2 (datalab-to/surya-ocr-2, 650M, qwen3_5) as a self-contained
UV script. Unlike the flat-markdown OCR scripts, it returns structure: a flattened
text column plus a `surya_blocks` JSON column (per-block HTML + bbox + reading order
+ confidence). `--task ocr|layout|table`, image and PDF input.
Engine: Surya normally spawns a vLLM server (Docker), which can't run in a Job. We
inject a custom in-process Backend that runs vLLM's offline LLM().chat() engine and
let Surya keep ownership of prompting, image scaling, and HTML/bbox parsing — offline
batch, no server. Runs on the pinned vllm/vllm-openai:v0.20.1 image (its qwen3_5
arch is recent/version-sensitive; vLLM lives at site-packages there, not dist-packages).
Validated on HF Jobs (l4x1): ocr 5/5, layout 3/3, table 3/3, pdf 1/1 (real arXiv PDF,
pages concatenated in text + per-page in surya_blocks). Weights are modified OpenRAIL-M.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|`surya-ocr.py`|[Surya OCR 2](https://huggingface.co/datalab-to/surya-ocr-2)| 0.65B | vLLM |**Structured** OCR + `--task layout\|table`: per-block HTML with bboxes & reading order in an extra `surya_blocks` column. 91 langs, top-under-3B on olmOCR-Bench. Modified OpenRAIL-M license. Needs the **pinned**`vllm/vllm-openai:v0.20.1` image |
**Variants & tools** (same models, different I/O): `glm-ocr-v2.py` adds checkpoint/resume for very large jobs · `glm-ocr-bucket.py` and `falcon-ocr-bucket.py` read images/PDFs from a mounted bucket and write one `.md` per page · `ocr-vllm-judge.py` runs pairwise OCR-quality comparisons.
73
74
75
+
`surya-ocr.py` is the structured outlier: besides the flattened text column it writes a `surya_blocks` JSON column (per-block HTML + bounding boxes + reading order), and `--task` switches between OCR, `layout`, and `table`. It runs as **offline vLLM batch** (no server) and must use the **pinned**`vllm/vllm-openai:v0.20.1` image — its `qwen3_5` architecture is recent and version-sensitive, and that image puts vLLM at `/usr/local/lib/python3.12/site-packages` (use `--python /usr/local/bin/python3`; the exact command is in the script's docstring). Weights are **modified OpenRAIL-M**.
76
+
74
77
## Structured extraction (image or text → JSON)
75
78
76
79
Most scripts here output markdown. These take a **schema** and return **structured data** instead — give them the fields you want, they fill them in:
@@ -194,6 +197,7 @@ Beyond the shared flags, some models add their own. Run `--help` on any script f
0 commit comments