Sync from GitHub via hub-sync
Browse files- README.md +1 -0
- jina-ocr-v1.py +377 -0
- models.json +185 -33
README.md
CHANGED
|
@@ -117,6 +117,7 @@ _Sorted by model size:_
|
|
| 117 |
| [`dots-mocr.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/dots-mocr.py) | [dots.mocr](https://huggingface.co/rednote-hilab/dots.mocr) | 3B | vLLM | 8 prompt modes incl. SVG generation, layout + bbox, 100+ languages |
|
| 118 |
| [`nanonets-ocr2.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/nanonets-ocr2.py) | [Nanonets-OCR2-3B](https://huggingface.co/nanonets/Nanonets-OCR2-3B) | 3B | vLLM | Next-gen, Qwen2.5-VL base. **Pin `--image vllm/vllm-openai:v0.10.2`** (vLLM ≥0.11 breaks Qwen2.5-VL → all `!`) |
|
| 119 |
| [`deepseek-ocr-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr-vllm.py) | [DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR) | 4B | vLLM | 5 resolution + 5 prompt modes |
|
|
|
|
| 120 |
| [`deepseek-ocr.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr.py) | [DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR) | 4B | Transformers | Same model, Transformers backend |
|
| 121 |
| [`deepseek-ocr2-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr2-vllm.py) | [DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | 3B | vLLM | Newer; needs nightly vLLM **+ the `vllm/vllm-openai` image** ([why](#if-a-vllm-script-crashes-at-startup-the-nvcc--nvrtc-error)) |
|
| 122 |
| [`unlimited-ocr-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/unlimited-ocr-vllm.py) | [Unlimited-OCR](https://huggingface.co/baidu/Unlimited-OCR) | 3.3B | vLLM | DeepSeek-OCR-based; layout-grounded markdown (`--strip-grounding` for clean text). Single-image batch — needs Baidu's **dedicated `vllm/vllm-openai:unlimited-ocr` image** (`-cu129` on Hopper). Multi-page "long-horizon" parsing → serve it ([doc](serving-unlimited-ocr.md)); both engines do clean docs, **SGLang more robust** on hard scans. MIT |
|
|
|
|
| 117 |
| [`dots-mocr.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/dots-mocr.py) | [dots.mocr](https://huggingface.co/rednote-hilab/dots.mocr) | 3B | vLLM | 8 prompt modes incl. SVG generation, layout + bbox, 100+ languages |
|
| 118 |
| [`nanonets-ocr2.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/nanonets-ocr2.py) | [Nanonets-OCR2-3B](https://huggingface.co/nanonets/Nanonets-OCR2-3B) | 3B | vLLM | Next-gen, Qwen2.5-VL base. **Pin `--image vllm/vllm-openai:v0.10.2`** (vLLM ≥0.11 breaks Qwen2.5-VL → all `!`) |
|
| 119 |
| [`deepseek-ocr-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr-vllm.py) | [DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR) | 4B | vLLM | 5 resolution + 5 prompt modes |
|
| 120 |
+
| [`jina-ocr-v1.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/jina-ocr-v1.py) | [jina-ocr-v1](https://huggingface.co/jinaai/jina-ocr-v1) | 3.4B MoE (~570M active) | vLLM | DeepSeek-OCR fine-tune + FastMTP speculative decoding (`--spec 0` to disable) and an n-gram repetition stop. Card: 91.14 OmniDocBench v1.6, **83.4 olmOCR-Bench**. Offline vLLM only. **CC-BY-NC-4.0** |
|
| 121 |
| [`deepseek-ocr.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr.py) | [DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR) | 4B | Transformers | Same model, Transformers backend |
|
| 122 |
| [`deepseek-ocr2-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/deepseek-ocr2-vllm.py) | [DeepSeek-OCR-2](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | 3B | vLLM | Newer; needs nightly vLLM **+ the `vllm/vllm-openai` image** ([why](#if-a-vllm-script-crashes-at-startup-the-nvcc--nvrtc-error)) |
|
| 123 |
| [`unlimited-ocr-vllm.py`](https://huggingface.co/datasets/uv-scripts/ocr/blob/main/unlimited-ocr-vllm.py) | [Unlimited-OCR](https://huggingface.co/baidu/Unlimited-OCR) | 3.3B | vLLM | DeepSeek-OCR-based; layout-grounded markdown (`--strip-grounding` for clean text). Single-image batch — needs Baidu's **dedicated `vllm/vllm-openai:unlimited-ocr` image** (`-cu129` on Hopper). Multi-page "long-horizon" parsing → serve it ([doc](serving-unlimited-ocr.md)); both engines do clean docs, **SGLang more robust** on hard scans. MIT |
|
jina-ocr-v1.py
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = ">=3.11"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0",
|
| 5 |
+
# "huggingface-hub",
|
| 6 |
+
# "pillow",
|
| 7 |
+
# "vllm>=0.21",
|
| 8 |
+
# "tqdm",
|
| 9 |
+
# "toolz",
|
| 10 |
+
# "torch",
|
| 11 |
+
# ]
|
| 12 |
+
#
|
| 13 |
+
# [tool.hf-jobs]
|
| 14 |
+
# flavor = "a10g-small"
|
| 15 |
+
# secrets = ["HF_TOKEN"]
|
| 16 |
+
# env = { UV_TORCH_BACKEND = "auto" }
|
| 17 |
+
# ///
|
| 18 |
+
|
| 19 |
+
"""
|
| 20 |
+
Convert document images to markdown using jina-ocr-v1 with vLLM (offline batch).
|
| 21 |
+
|
| 22 |
+
jina-ocr-v1 (Jina AI, 2026-09) is a DeepSeek-OCR fine-tune: the DeepEncoder vision
|
| 23 |
+
tower plus a 3B mixture-of-experts decoder with ~570M active parameters, and a
|
| 24 |
+
FastMTP speculative-decoding head (one draft block reused for K=3 steps). The
|
| 25 |
+
card reports 91.14 on OmniDocBench v1.6 and 83.4 on olmOCR-Bench. Licence:
|
| 26 |
+
CC-BY-NC-4.0 (non-commercial).
|
| 27 |
+
|
| 28 |
+
The model ships its own vLLM glue in the checkpoint (`deepseek_ocr_mtp.py`):
|
| 29 |
+
architecture registration, the speculative config, and an n-gram repetition
|
| 30 |
+
stop built on vLLM's own `repetition_detection`. This recipe follows the card's
|
| 31 |
+
offline pattern exactly: put the snapshot on the import path, `register()`
|
| 32 |
+
once, then `LLM(**vllm_llm_kwargs(...))` and `llm.chat(...)`.
|
| 33 |
+
|
| 34 |
+
Run on HF Jobs (hardware and the HF_TOKEN secret come from the script's
|
| 35 |
+
[tool.hf-jobs] header; `hf` CLI 1.32+):
|
| 36 |
+
|
| 37 |
+
hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/jina-ocr-v1.py \\
|
| 38 |
+
<input-dataset> <output-dataset>
|
| 39 |
+
|
| 40 |
+
Notes:
|
| 41 |
+
- `--spec 0` disables speculative decoding (A/B it: FastMTP is a latency trick
|
| 42 |
+
that helps most at low concurrency; at batch 16 the gain may be small).
|
| 43 |
+
- `--no-repetition-stop` disables the card's n-gram stop.
|
| 44 |
+
- Uses vLLM from PyPI on the default uv image; the first run spends a few
|
| 45 |
+
minutes installing it. `--image vllm/vllm-openai:<tag>` skips that.
|
| 46 |
+
|
| 47 |
+
Model: jinaai/jina-ocr-v1
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
import argparse
|
| 51 |
+
import io
|
| 52 |
+
import json
|
| 53 |
+
import logging
|
| 54 |
+
import os
|
| 55 |
+
import sys
|
| 56 |
+
from datetime import datetime
|
| 57 |
+
from typing import Any, Dict, Union
|
| 58 |
+
|
| 59 |
+
from datasets import load_dataset
|
| 60 |
+
from huggingface_hub import DatasetCard, login, snapshot_download
|
| 61 |
+
from PIL import Image
|
| 62 |
+
from toolz import partition_all
|
| 63 |
+
from tqdm.auto import tqdm
|
| 64 |
+
|
| 65 |
+
# The default uv-script image has no nvcc; vLLM's FlashInfer sampler would JIT a
|
| 66 |
+
# kernel and crash engine init. Greedy OCR does not need it. No-op on vllm images.
|
| 67 |
+
os.environ.setdefault("VLLM_USE_FLASHINFER_SAMPLER", "0")
|
| 68 |
+
# register() adds architectures to this process's ModelRegistry; the engine worker only
|
| 69 |
+
# sees them if it is forked, not spawned. Nothing below initialises CUDA before LLM().
|
| 70 |
+
os.environ.setdefault("VLLM_WORKER_MULTIPROC_METHOD", "fork")
|
| 71 |
+
|
| 72 |
+
logging.basicConfig(level=logging.INFO)
|
| 73 |
+
logger = logging.getLogger(__name__)
|
| 74 |
+
|
| 75 |
+
MODEL_ID = "jinaai/jina-ocr-v1"
|
| 76 |
+
SCRIPT_NAME = "jina-ocr-v1.py"
|
| 77 |
+
SCRIPT_URL = f"https://huggingface.co/datasets/uv-scripts/ocr/raw/main/{SCRIPT_NAME}"
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def check_cuda_availability():
|
| 81 |
+
"""GPU check WITHOUT initialising CUDA in this process.
|
| 82 |
+
|
| 83 |
+
torch.cuda.is_available() would initialise CUDA here, and vLLM then forces the
|
| 84 |
+
`spawn` start method for its engine worker. A spawned worker does not inherit the
|
| 85 |
+
ModelRegistry entries that register() adds in this process, so the custom
|
| 86 |
+
architecture is "not supported" in the worker (seen on the first smoke run).
|
| 87 |
+
nvidia-smi answers the same question with no CUDA context.
|
| 88 |
+
"""
|
| 89 |
+
import shutil
|
| 90 |
+
import subprocess
|
| 91 |
+
|
| 92 |
+
if shutil.which("nvidia-smi") is None:
|
| 93 |
+
logger.error("nvidia-smi not found. This script requires a GPU.")
|
| 94 |
+
sys.exit(1)
|
| 95 |
+
try:
|
| 96 |
+
out = subprocess.run(["nvidia-smi", "--query-gpu=name", "--format=csv,noheader"],
|
| 97 |
+
capture_output=True, text=True, timeout=30, check=True).stdout.strip()
|
| 98 |
+
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e:
|
| 99 |
+
logger.error(f"nvidia-smi failed: {e}. This script requires a GPU.")
|
| 100 |
+
sys.exit(1)
|
| 101 |
+
logger.info(f"GPU: {out.splitlines()[0] if out else 'unknown'}")
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def ensure_output_columns_free(dataset, columns, overwrite=False):
|
| 105 |
+
"""Fail fast if an output column would overwrite an existing input column."""
|
| 106 |
+
clash = [c for c in columns if c in dataset.column_names]
|
| 107 |
+
if not clash:
|
| 108 |
+
return dataset
|
| 109 |
+
if overwrite:
|
| 110 |
+
logger.warning(f"--overwrite: replacing existing column(s) {clash}")
|
| 111 |
+
return dataset.remove_columns(clash)
|
| 112 |
+
logger.error(f"Output column(s) {clash} already exist in the input dataset (columns: {dataset.column_names}).")
|
| 113 |
+
logger.error("Choose a different --output-column, or pass --overwrite to replace them.")
|
| 114 |
+
sys.exit(1)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def to_pil(image: Union[Image.Image, Dict[str, Any], str]) -> Image.Image:
|
| 118 |
+
if isinstance(image, Image.Image):
|
| 119 |
+
return image
|
| 120 |
+
if isinstance(image, dict) and "bytes" in image:
|
| 121 |
+
return Image.open(io.BytesIO(image["bytes"]))
|
| 122 |
+
if isinstance(image, str):
|
| 123 |
+
return Image.open(image)
|
| 124 |
+
raise ValueError(f"Unsupported image type: {type(image)}")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def load_model_glue(revision: str | None):
|
| 128 |
+
"""Download the checkpoint and import its vLLM helpers.
|
| 129 |
+
|
| 130 |
+
vLLM v1 starts its engine core as a *spawned* process, which does not inherit
|
| 131 |
+
sys.path edits, so the snapshot directory also goes into PYTHONPATH before LLM()
|
| 132 |
+
is created. The architecture override points at `deepseek_ocr_mtp`, which the
|
| 133 |
+
worker must be able to import.
|
| 134 |
+
"""
|
| 135 |
+
snapshot = snapshot_download(MODEL_ID, revision=revision)
|
| 136 |
+
os.environ["PYTHONPATH"] = snapshot + os.pathsep + os.environ.get("PYTHONPATH", "")
|
| 137 |
+
sys.path.insert(0, snapshot)
|
| 138 |
+
import deepseek_ocr_mtp # noqa: E402 (lives in the checkpoint)
|
| 139 |
+
|
| 140 |
+
return snapshot, deepseek_ocr_mtp
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def create_dataset_card(
|
| 144 |
+
source_dataset: str,
|
| 145 |
+
num_samples: int,
|
| 146 |
+
processing_time: str,
|
| 147 |
+
batch_size: int,
|
| 148 |
+
max_model_len: int,
|
| 149 |
+
max_tokens: int,
|
| 150 |
+
spec: int,
|
| 151 |
+
repetition_stop: bool,
|
| 152 |
+
image_column: str,
|
| 153 |
+
output_column: str,
|
| 154 |
+
split: str,
|
| 155 |
+
image_count_per_sec: float,
|
| 156 |
+
) -> str:
|
| 157 |
+
on_jobs = os.environ.get("JOB_ID") is not None
|
| 158 |
+
hw = os.environ.get("ACCELERATOR") or ""
|
| 159 |
+
origin = (
|
| 160 |
+
"Produced on [Hugging Face Jobs](https://huggingface.co/docs/huggingface_hub/guides/jobs)"
|
| 161 |
+
+ (f" (`{hw}`)" if hw else "")
|
| 162 |
+
) if on_jobs else "Generated"
|
| 163 |
+
tags = ["ocr", "document-processing", "jina-ocr", "markdown", "uv-script", "generated"]
|
| 164 |
+
if on_jobs:
|
| 165 |
+
tags.append("hf-jobs")
|
| 166 |
+
tag_lines = "\n".join(f"- {t}" for t in tags)
|
| 167 |
+
|
| 168 |
+
return f"""---
|
| 169 |
+
tags:
|
| 170 |
+
{tag_lines}
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
# Document OCR using jina-ocr-v1
|
| 174 |
+
|
| 175 |
+
Markdown OCR of the images in [{source_dataset}](https://huggingface.co/datasets/{source_dataset})
|
| 176 |
+
using [{MODEL_ID}](https://huggingface.co/{MODEL_ID}) (DeepSeek-OCR fine-tune, ~570M active parameters,
|
| 177 |
+
FastMTP speculative decoding). The model is released under CC-BY-NC-4.0; check that licence before
|
| 178 |
+
reusing these outputs commercially.
|
| 179 |
+
|
| 180 |
+
## Processing Details
|
| 181 |
+
|
| 182 |
+
- **Source Dataset**: [{source_dataset}](https://huggingface.co/datasets/{source_dataset})
|
| 183 |
+
- **Model**: [{MODEL_ID}](https://huggingface.co/{MODEL_ID})
|
| 184 |
+
- **Number of Samples**: {num_samples:,}
|
| 185 |
+
- **Processing Time**: {processing_time} (~{image_count_per_sec:.2f} images/second including model load)
|
| 186 |
+
- **Processing Date**: {datetime.now().strftime("%Y-%m-%d %H:%M UTC")}
|
| 187 |
+
|
| 188 |
+
### Configuration
|
| 189 |
+
|
| 190 |
+
- **Image Column**: `{image_column}`
|
| 191 |
+
- **Output Column**: `{output_column}`
|
| 192 |
+
- **Dataset Split**: `{split}`
|
| 193 |
+
- **Batch Size**: {batch_size}
|
| 194 |
+
- **Max Model Length**: {max_model_len:,} tokens
|
| 195 |
+
- **Max Output Tokens**: {max_tokens:,}
|
| 196 |
+
- **Speculative decoding (FastMTP draft depth)**: {spec}
|
| 197 |
+
- **N-gram repetition stop**: {"on" if repetition_stop else "off"}
|
| 198 |
+
|
| 199 |
+
## Dataset Structure
|
| 200 |
+
|
| 201 |
+
All original columns plus:
|
| 202 |
+
- `{output_column}`: the extracted text as markdown (HTML tables, LaTeX math)
|
| 203 |
+
- `inference_info`: JSON list tracking the OCR models applied to this dataset
|
| 204 |
+
|
| 205 |
+
## Reproduction
|
| 206 |
+
|
| 207 |
+
{origin} with the [`{SCRIPT_NAME}`]({SCRIPT_URL}) recipe from [uv-scripts](https://huggingface.co/uv-scripts). Run it yourself:
|
| 208 |
+
|
| 209 |
+
```bash
|
| 210 |
+
hf jobs uv run {SCRIPT_URL} \\
|
| 211 |
+
{source_dataset} \\
|
| 212 |
+
<output-dataset> \\
|
| 213 |
+
--image-column {image_column} \\
|
| 214 |
+
--batch-size {batch_size} \\
|
| 215 |
+
--spec {spec}
|
| 216 |
+
```
|
| 217 |
+
"""
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
def main():
|
| 221 |
+
ap = argparse.ArgumentParser(description="jina-ocr-v1 batch OCR with vLLM (offline)")
|
| 222 |
+
ap.add_argument("input_dataset")
|
| 223 |
+
ap.add_argument("output_dataset")
|
| 224 |
+
ap.add_argument("--image-column", default="image")
|
| 225 |
+
ap.add_argument("--output-column", default="markdown")
|
| 226 |
+
ap.add_argument("--overwrite", action="store_true", help="Replace an existing output column")
|
| 227 |
+
ap.add_argument("--split", default="train")
|
| 228 |
+
ap.add_argument("--input-config", default=None, help="Config (subset) name of the input dataset")
|
| 229 |
+
ap.add_argument("--config", default=None, help="Config name for the output dataset")
|
| 230 |
+
ap.add_argument("--max-samples", type=int, default=None)
|
| 231 |
+
ap.add_argument("--shuffle", action="store_true")
|
| 232 |
+
ap.add_argument("--seed", type=int, default=42)
|
| 233 |
+
ap.add_argument("--batch-size", type=int, default=16)
|
| 234 |
+
ap.add_argument("--max-tokens", type=int, default=4096)
|
| 235 |
+
ap.add_argument("--max-model-len", type=int, default=8192)
|
| 236 |
+
ap.add_argument("--gpu-memory-utilization", type=float, default=0.85)
|
| 237 |
+
ap.add_argument("--spec", type=int, default=3, help="FastMTP draft depth K; 0 disables speculative decoding")
|
| 238 |
+
ap.add_argument("--no-repetition-stop", action="store_true", help="Disable the card's n-gram repetition stop")
|
| 239 |
+
ap.add_argument("--prompt", default=None, help="Override the model's default OCR prompt")
|
| 240 |
+
ap.add_argument("--revision", default=None, help="Model revision to pin")
|
| 241 |
+
ap.add_argument("--private", action="store_true")
|
| 242 |
+
ap.add_argument("--create-pr", action="store_true")
|
| 243 |
+
ap.add_argument("--hf-token", default=None)
|
| 244 |
+
ap.add_argument("--verbose", action="store_true", help="Log resolved package versions after the run")
|
| 245 |
+
args = ap.parse_args()
|
| 246 |
+
|
| 247 |
+
check_cuda_availability()
|
| 248 |
+
start_time = datetime.now()
|
| 249 |
+
|
| 250 |
+
hf_token = args.hf_token or os.environ.get("HF_TOKEN")
|
| 251 |
+
if hf_token:
|
| 252 |
+
login(token=hf_token)
|
| 253 |
+
|
| 254 |
+
logger.info(f"Loading dataset: {args.input_dataset}")
|
| 255 |
+
dataset = load_dataset(args.input_dataset, name=args.input_config, split=args.split)
|
| 256 |
+
if args.image_column not in dataset.column_names:
|
| 257 |
+
raise ValueError(f"Column '{args.image_column}' not found. Available: {dataset.column_names}")
|
| 258 |
+
dataset = ensure_output_columns_free(dataset, [args.output_column], overwrite=args.overwrite)
|
| 259 |
+
if args.shuffle:
|
| 260 |
+
dataset = dataset.shuffle(seed=args.seed)
|
| 261 |
+
if args.max_samples:
|
| 262 |
+
dataset = dataset.select(range(min(args.max_samples, len(dataset))))
|
| 263 |
+
logger.info(f"Limited to {len(dataset)} samples")
|
| 264 |
+
|
| 265 |
+
# --- model: the checkpoint's own vLLM glue, in the card's order ---------------
|
| 266 |
+
snapshot, glue = load_model_glue(args.revision)
|
| 267 |
+
from vllm import LLM
|
| 268 |
+
|
| 269 |
+
glue.register()
|
| 270 |
+
llm_kwargs = glue.vllm_llm_kwargs(
|
| 271 |
+
snapshot, num_speculative_tokens=args.spec, mtp_heads=1, mtp_recursive=True,
|
| 272 |
+
)
|
| 273 |
+
llm_kwargs.setdefault("max_model_len", args.max_model_len)
|
| 274 |
+
llm_kwargs.setdefault("gpu_memory_utilization", args.gpu_memory_utilization)
|
| 275 |
+
llm_kwargs.setdefault("enable_prefix_caching", False)
|
| 276 |
+
llm_kwargs.setdefault("mm_processor_cache_gb", 0)
|
| 277 |
+
llm_kwargs.setdefault("limit_mm_per_prompt", {"image": 1})
|
| 278 |
+
logger.info(f"Initializing vLLM with {MODEL_ID} (spec={args.spec}); this can take a few minutes")
|
| 279 |
+
llm = LLM(**llm_kwargs)
|
| 280 |
+
|
| 281 |
+
sampling_kwargs = {"max_tokens": args.max_tokens}
|
| 282 |
+
if args.no_repetition_stop:
|
| 283 |
+
sampling_kwargs["repetition_detection"] = None
|
| 284 |
+
sampling_params = glue.vllm_sampling_params(**sampling_kwargs)
|
| 285 |
+
prompt = args.prompt or glue.DEFAULT_OCR_PROMPT
|
| 286 |
+
logger.info(f"Prompt: {prompt}")
|
| 287 |
+
|
| 288 |
+
# --- inference ------------------------------------------------------------------
|
| 289 |
+
all_markdown = []
|
| 290 |
+
n_batches = (len(dataset) + args.batch_size - 1) // args.batch_size
|
| 291 |
+
for batch_indices in tqdm(partition_all(args.batch_size, range(len(dataset))), total=n_batches, desc="jina-ocr-v1"):
|
| 292 |
+
batch_indices = list(batch_indices)
|
| 293 |
+
batch_images = [dataset[i][args.image_column] for i in batch_indices]
|
| 294 |
+
try:
|
| 295 |
+
messages = []
|
| 296 |
+
for img in batch_images:
|
| 297 |
+
pil_img = to_pil(img).convert("RGB")
|
| 298 |
+
messages.append([{"role": "user", "content": [
|
| 299 |
+
{"type": "image_pil", "image_pil": pil_img},
|
| 300 |
+
{"type": "text", "text": prompt},
|
| 301 |
+
]}])
|
| 302 |
+
outputs = llm.chat(messages, sampling_params=sampling_params, use_tqdm=False)
|
| 303 |
+
for output in outputs:
|
| 304 |
+
all_markdown.append(output.outputs[0].text.strip())
|
| 305 |
+
except Exception as e:
|
| 306 |
+
logger.error(f"Error processing batch: {e}")
|
| 307 |
+
all_markdown.extend(["[OCR FAILED]"] * len(batch_images))
|
| 308 |
+
|
| 309 |
+
if args.spec > 0:
|
| 310 |
+
glue.log_spec_stats(llm)
|
| 311 |
+
|
| 312 |
+
processing_duration = datetime.now() - start_time
|
| 313 |
+
processing_time_str = f"{processing_duration.total_seconds() / 60:.1f} min"
|
| 314 |
+
images_per_sec = len(dataset) / max(1.0, processing_duration.total_seconds())
|
| 315 |
+
|
| 316 |
+
# --- output dataset ---------------------------------------------------------------
|
| 317 |
+
dataset = dataset.add_column(args.output_column, all_markdown)
|
| 318 |
+
inference_entry = {
|
| 319 |
+
"model_id": MODEL_ID,
|
| 320 |
+
"model_name": "jina-ocr-v1",
|
| 321 |
+
"column_name": args.output_column,
|
| 322 |
+
"timestamp": datetime.now().isoformat(),
|
| 323 |
+
"prompt": "custom" if args.prompt else "default",
|
| 324 |
+
"batch_size": args.batch_size,
|
| 325 |
+
"max_tokens": args.max_tokens,
|
| 326 |
+
"max_model_len": args.max_model_len,
|
| 327 |
+
"speculative_tokens": args.spec,
|
| 328 |
+
"repetition_stop": not args.no_repetition_stop,
|
| 329 |
+
"script": SCRIPT_NAME,
|
| 330 |
+
"script_url": SCRIPT_URL,
|
| 331 |
+
}
|
| 332 |
+
if "inference_info" in dataset.column_names:
|
| 333 |
+
def update_inference_info(example):
|
| 334 |
+
try:
|
| 335 |
+
existing = json.loads(example["inference_info"]) if example["inference_info"] else []
|
| 336 |
+
except (json.JSONDecodeError, TypeError):
|
| 337 |
+
existing = []
|
| 338 |
+
existing.append(inference_entry)
|
| 339 |
+
return {"inference_info": json.dumps(existing)}
|
| 340 |
+
dataset = dataset.map(update_inference_info)
|
| 341 |
+
else:
|
| 342 |
+
dataset = dataset.add_column("inference_info", [json.dumps([inference_entry])] * len(dataset))
|
| 343 |
+
|
| 344 |
+
logger.info(f"Pushing to {args.output_dataset}")
|
| 345 |
+
dataset.push_to_hub(
|
| 346 |
+
args.output_dataset,
|
| 347 |
+
private=args.private,
|
| 348 |
+
token=hf_token,
|
| 349 |
+
**({"config_name": args.config} if args.config else {}),
|
| 350 |
+
create_pr=args.create_pr,
|
| 351 |
+
commit_message=f"Add {MODEL_ID} OCR results ({len(dataset)} samples)" + (f" [{args.config}]" if args.config else ""),
|
| 352 |
+
)
|
| 353 |
+
card = DatasetCard(create_dataset_card(
|
| 354 |
+
source_dataset=args.input_dataset, num_samples=len(dataset), processing_time=processing_time_str,
|
| 355 |
+
batch_size=args.batch_size, max_model_len=args.max_model_len, max_tokens=args.max_tokens,
|
| 356 |
+
spec=args.spec, repetition_stop=not args.no_repetition_stop, image_column=args.image_column,
|
| 357 |
+
output_column=args.output_column, split=args.split, image_count_per_sec=images_per_sec,
|
| 358 |
+
))
|
| 359 |
+
card.push_to_hub(args.output_dataset, token=hf_token)
|
| 360 |
+
logger.info(f"Dataset available at: https://huggingface.co/datasets/{args.output_dataset}")
|
| 361 |
+
logger.info(f"Processing time: {processing_time_str}")
|
| 362 |
+
|
| 363 |
+
failed = sum(1 for m in all_markdown if m == "[OCR FAILED]")
|
| 364 |
+
if failed:
|
| 365 |
+
logger.warning(f"{failed} of {len(all_markdown)} rows are [OCR FAILED] (a whole batch fails together in offline mode)")
|
| 366 |
+
|
| 367 |
+
if args.verbose:
|
| 368 |
+
import importlib.metadata
|
| 369 |
+
for pkg in ["vllm", "transformers", "torch", "datasets", "pillow"]:
|
| 370 |
+
try:
|
| 371 |
+
logger.info(f"{pkg}=={importlib.metadata.version(pkg)}")
|
| 372 |
+
except importlib.metadata.PackageNotFoundError:
|
| 373 |
+
logger.info(f"{pkg}: not installed")
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
if __name__ == "__main__":
|
| 377 |
+
main()
|
models.json
CHANGED
|
@@ -26,7 +26,10 @@
|
|
| 26 |
"task": "ocr",
|
| 27 |
"output": "plain text",
|
| 28 |
"license": "apache-2.0",
|
| 29 |
-
"languages": {
|
|
|
|
|
|
|
|
|
|
| 30 |
},
|
| 31 |
"falcon-ocr.py": {
|
| 32 |
"model_id": "tiiuae/Falcon-OCR",
|
|
@@ -35,7 +38,9 @@
|
|
| 35 |
"task": "ocr",
|
| 36 |
"output": "markdown",
|
| 37 |
"license": "apache-2.0",
|
| 38 |
-
"languages": {
|
|
|
|
|
|
|
| 39 |
},
|
| 40 |
"smoldocling-ocr.py": {
|
| 41 |
"model_id": "ds4sd/SmolDocling-256M-preview",
|
|
@@ -43,7 +48,9 @@
|
|
| 43 |
"backend": "transformers",
|
| 44 |
"task": "ocr",
|
| 45 |
"output": "DocTags",
|
| 46 |
-
"languages": {
|
|
|
|
|
|
|
| 47 |
},
|
| 48 |
"surya-ocr.py": {
|
| 49 |
"model_id": "datalab-to/surya-ocr-2",
|
|
@@ -69,7 +76,16 @@
|
|
| 69 |
"languages": {
|
| 70 |
"evidence": "named-list",
|
| 71 |
"count": 8,
|
| 72 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
"notes": "Declared in card metadata only; no per-language evidence in the card body."
|
| 74 |
}
|
| 75 |
},
|
|
@@ -116,7 +132,9 @@
|
|
| 116 |
"task": "ocr",
|
| 117 |
"output": "markdown + LaTeX + HTML tables",
|
| 118 |
"license": "apache-2.0",
|
| 119 |
-
"languages": {
|
|
|
|
|
|
|
| 120 |
},
|
| 121 |
"ovis-ocr2-server.py": {
|
| 122 |
"model_id": "ATH-MaaS/OvisOCR2",
|
|
@@ -127,7 +145,9 @@
|
|
| 127 |
"output": "markdown + LaTeX + HTML tables",
|
| 128 |
"license": "apache-2.0",
|
| 129 |
"notes": "Server-mode sibling of ovis-ocr2.py: ~1.7x its inference throughput, per-request failure isolation. See SERVING.md.",
|
| 130 |
-
"languages": {
|
|
|
|
|
|
|
| 131 |
},
|
| 132 |
"ovis-ocr2-saturate.py": {
|
| 133 |
"model_id": "ATH-MaaS/OvisOCR2",
|
|
@@ -138,7 +158,9 @@
|
|
| 138 |
"output": "markdown + LaTeX + HTML tables",
|
| 139 |
"license": "apache-2.0",
|
| 140 |
"notes": "saturate companion of ovis-ocr2-server.py: same model/prompt/sampling/post-processing; the driver half (adaptive concurrency, retries, resumable parquet output, durable error rows) is the saturate library. SERVING dict at the top of the script is the machine-readable tuning prior.",
|
| 141 |
-
"languages": {
|
|
|
|
|
|
|
| 142 |
},
|
| 143 |
"lighton-ocr.py": {
|
| 144 |
"model_id": "lightonai/LightOnOCR-1B-1025",
|
|
@@ -149,7 +171,17 @@
|
|
| 149 |
"languages": {
|
| 150 |
"evidence": "named-list",
|
| 151 |
"count": 9,
|
| 152 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
"notes": "Explicitly European / Latin-alphabet focused."
|
| 154 |
}
|
| 155 |
},
|
|
@@ -162,7 +194,19 @@
|
|
| 162 |
"languages": {
|
| 163 |
"evidence": "named-list",
|
| 164 |
"count": 11,
|
| 165 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 167 |
}
|
| 168 |
},
|
|
@@ -177,7 +221,19 @@
|
|
| 177 |
"languages": {
|
| 178 |
"evidence": "named-list",
|
| 179 |
"count": 11,
|
| 180 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 182 |
}
|
| 183 |
},
|
|
@@ -192,7 +248,19 @@
|
|
| 192 |
"languages": {
|
| 193 |
"evidence": "named-list",
|
| 194 |
"count": 11,
|
| 195 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 197 |
}
|
| 198 |
},
|
|
@@ -204,7 +272,9 @@
|
|
| 204 |
"task": "ocr",
|
| 205 |
"output": "markdown",
|
| 206 |
"license": "Hunyuan Community License (excludes EU/UK/KR)",
|
| 207 |
-
"languages": {
|
|
|
|
|
|
|
| 208 |
},
|
| 209 |
"hunyuan-ocr-1.5.py": {
|
| 210 |
"model_id": "tencent/HunyuanOCR",
|
|
@@ -237,7 +307,9 @@
|
|
| 237 |
"task": "ocr",
|
| 238 |
"output": "markdown",
|
| 239 |
"license": "apache-2.0",
|
| 240 |
-
"languages": {
|
|
|
|
|
|
|
| 241 |
},
|
| 242 |
"abot-ocr.py": {
|
| 243 |
"model_id": "acvlab/ABot-OCR",
|
|
@@ -246,7 +318,9 @@
|
|
| 246 |
"image": "vllm/vllm-openai",
|
| 247 |
"task": "ocr",
|
| 248 |
"output": "markdown (text, LaTeX, HTML tables)",
|
| 249 |
-
"languages": {
|
|
|
|
|
|
|
| 250 |
},
|
| 251 |
"nanonets-ocr.py": {
|
| 252 |
"model_id": "nanonets/Nanonets-OCR-s",
|
|
@@ -254,7 +328,9 @@
|
|
| 254 |
"backend": "vllm",
|
| 255 |
"task": "ocr",
|
| 256 |
"output": "markdown (LaTeX, tables, forms)",
|
| 257 |
-
"languages": {
|
|
|
|
|
|
|
| 258 |
},
|
| 259 |
"dots-mocr.py": {
|
| 260 |
"model_id": "rednote-hilab/dots.mocr",
|
|
@@ -262,7 +338,9 @@
|
|
| 262 |
"backend": "vllm",
|
| 263 |
"task": "ocr | 8 prompt modes incl. SVG, layout + bbox",
|
| 264 |
"output": "markdown",
|
| 265 |
-
"languages": {
|
|
|
|
|
|
|
| 266 |
},
|
| 267 |
"nanonets-ocr2.py": {
|
| 268 |
"model_id": "nanonets/Nanonets-OCR2-3B",
|
|
@@ -274,7 +352,19 @@
|
|
| 274 |
"languages": {
|
| 275 |
"evidence": "named-list",
|
| 276 |
"count": "11 named + 'many more'",
|
| 277 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
"notes": "Only card claiming multilingual handwriting; list illustrative, no per-language benchmark."
|
| 279 |
}
|
| 280 |
},
|
|
@@ -285,7 +375,23 @@
|
|
| 285 |
"task": "ocr | 5 resolution + 5 prompt modes",
|
| 286 |
"output": "markdown",
|
| 287 |
"license": "mit",
|
| 288 |
-
"languages": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
},
|
| 290 |
"deepseek-ocr.py": {
|
| 291 |
"model_id": "deepseek-ai/DeepSeek-OCR",
|
|
@@ -294,7 +400,9 @@
|
|
| 294 |
"task": "ocr",
|
| 295 |
"output": "markdown",
|
| 296 |
"license": "mit",
|
| 297 |
-
"languages": {
|
|
|
|
|
|
|
| 298 |
},
|
| 299 |
"deepseek-ocr2-vllm.py": {
|
| 300 |
"model_id": "deepseek-ai/DeepSeek-OCR-2",
|
|
@@ -304,7 +412,9 @@
|
|
| 304 |
"task": "ocr",
|
| 305 |
"output": "markdown",
|
| 306 |
"license": "apache-2.0",
|
| 307 |
-
"languages": {
|
|
|
|
|
|
|
| 308 |
},
|
| 309 |
"unlimited-ocr-vllm.py": {
|
| 310 |
"model_id": "baidu/Unlimited-OCR",
|
|
@@ -314,7 +424,9 @@
|
|
| 314 |
"task": "ocr (layout-grounded markdown; single-image batch)",
|
| 315 |
"output": "markdown",
|
| 316 |
"license": "mit",
|
| 317 |
-
"languages": {
|
|
|
|
|
|
|
| 318 |
},
|
| 319 |
"nuextract3.py": {
|
| 320 |
"model_id": "numind/NuExtract3",
|
|
@@ -323,7 +435,9 @@
|
|
| 323 |
"image": "vllm/vllm-openai",
|
| 324 |
"task": "ocr | schema-guided extraction",
|
| 325 |
"output": "markdown or JSON",
|
| 326 |
-
"languages": {
|
|
|
|
|
|
|
| 327 |
},
|
| 328 |
"qianfan-ocr.py": {
|
| 329 |
"model_id": "baidu/Qianfan-OCR",
|
|
@@ -343,7 +457,9 @@
|
|
| 343 |
"backend": "vllm",
|
| 344 |
"task": "ocr",
|
| 345 |
"output": "markdown",
|
| 346 |
-
"languages": {
|
|
|
|
|
|
|
| 347 |
},
|
| 348 |
"rolm-ocr.py": {
|
| 349 |
"model_id": "reducto/RolmOCR",
|
|
@@ -351,7 +467,9 @@
|
|
| 351 |
"backend": "vllm",
|
| 352 |
"task": "ocr",
|
| 353 |
"output": "plain text",
|
| 354 |
-
"languages": {
|
|
|
|
|
|
|
| 355 |
},
|
| 356 |
"numarkdown-ocr.py": {
|
| 357 |
"model_id": "numind/NuMarkdown-8B-Thinking",
|
|
@@ -359,7 +477,9 @@
|
|
| 359 |
"backend": "vllm",
|
| 360 |
"task": "ocr (reasoning)",
|
| 361 |
"output": "markdown",
|
| 362 |
-
"languages": {
|
|
|
|
|
|
|
| 363 |
},
|
| 364 |
"lfm2-vl-extract.py": {
|
| 365 |
"model_id": "LiquidAI/LFM2.5-VL-1.6B-Extract",
|
|
@@ -383,7 +503,17 @@
|
|
| 383 |
"languages": {
|
| 384 |
"evidence": "named-list",
|
| 385 |
"count": 9,
|
| 386 |
-
"named": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
"notes": "Text-only model (not OCR). Card prose names 9 incl. Portuguese; card YAML lists 8 (pt missing)."
|
| 388 |
}
|
| 389 |
},
|
|
@@ -394,7 +524,9 @@
|
|
| 394 |
"task": "schema-guided extraction (image or multi-page PDF -> JSON)",
|
| 395 |
"output": "JSON",
|
| 396 |
"license": "modified OpenRAIL-M",
|
| 397 |
-
"languages": {
|
|
|
|
|
|
|
| 398 |
},
|
| 399 |
"pp-doclayout.py": {
|
| 400 |
"model_id": "PaddlePaddle/PP-DocLayout-L",
|
|
@@ -402,11 +534,31 @@
|
|
| 402 |
"backend": "paddleocr",
|
| 403 |
"task": "layout detection (no text extraction)",
|
| 404 |
"output": "bounding boxes + region classes",
|
| 405 |
-
"languages": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
},
|
| 407 |
-
"
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
"ocr-vllm-judge.py": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
}
|
|
|
|
| 26 |
"task": "ocr",
|
| 27 |
"output": "plain text",
|
| 28 |
"license": "apache-2.0",
|
| 29 |
+
"languages": {
|
| 30 |
+
"evidence": "count-claim",
|
| 31 |
+
"count": 48
|
| 32 |
+
}
|
| 33 |
},
|
| 34 |
"falcon-ocr.py": {
|
| 35 |
"model_id": "tiiuae/Falcon-OCR",
|
|
|
|
| 38 |
"task": "ocr",
|
| 39 |
"output": "markdown",
|
| 40 |
"license": "apache-2.0",
|
| 41 |
+
"languages": {
|
| 42 |
+
"evidence": "not-stated"
|
| 43 |
+
}
|
| 44 |
},
|
| 45 |
"smoldocling-ocr.py": {
|
| 46 |
"model_id": "ds4sd/SmolDocling-256M-preview",
|
|
|
|
| 48 |
"backend": "transformers",
|
| 49 |
"task": "ocr",
|
| 50 |
"output": "DocTags",
|
| 51 |
+
"languages": {
|
| 52 |
+
"evidence": "english-only"
|
| 53 |
+
}
|
| 54 |
},
|
| 55 |
"surya-ocr.py": {
|
| 56 |
"model_id": "datalab-to/surya-ocr-2",
|
|
|
|
| 76 |
"languages": {
|
| 77 |
"evidence": "named-list",
|
| 78 |
"count": 8,
|
| 79 |
+
"named": [
|
| 80 |
+
"zh",
|
| 81 |
+
"en",
|
| 82 |
+
"fr",
|
| 83 |
+
"es",
|
| 84 |
+
"ru",
|
| 85 |
+
"de",
|
| 86 |
+
"ja",
|
| 87 |
+
"ko"
|
| 88 |
+
],
|
| 89 |
"notes": "Declared in card metadata only; no per-language evidence in the card body."
|
| 90 |
}
|
| 91 |
},
|
|
|
|
| 132 |
"task": "ocr",
|
| 133 |
"output": "markdown + LaTeX + HTML tables",
|
| 134 |
"license": "apache-2.0",
|
| 135 |
+
"languages": {
|
| 136 |
+
"evidence": "not-stated"
|
| 137 |
+
}
|
| 138 |
},
|
| 139 |
"ovis-ocr2-server.py": {
|
| 140 |
"model_id": "ATH-MaaS/OvisOCR2",
|
|
|
|
| 145 |
"output": "markdown + LaTeX + HTML tables",
|
| 146 |
"license": "apache-2.0",
|
| 147 |
"notes": "Server-mode sibling of ovis-ocr2.py: ~1.7x its inference throughput, per-request failure isolation. See SERVING.md.",
|
| 148 |
+
"languages": {
|
| 149 |
+
"evidence": "not-stated"
|
| 150 |
+
}
|
| 151 |
},
|
| 152 |
"ovis-ocr2-saturate.py": {
|
| 153 |
"model_id": "ATH-MaaS/OvisOCR2",
|
|
|
|
| 158 |
"output": "markdown + LaTeX + HTML tables",
|
| 159 |
"license": "apache-2.0",
|
| 160 |
"notes": "saturate companion of ovis-ocr2-server.py: same model/prompt/sampling/post-processing; the driver half (adaptive concurrency, retries, resumable parquet output, durable error rows) is the saturate library. SERVING dict at the top of the script is the machine-readable tuning prior.",
|
| 161 |
+
"languages": {
|
| 162 |
+
"evidence": "not-stated"
|
| 163 |
+
}
|
| 164 |
},
|
| 165 |
"lighton-ocr.py": {
|
| 166 |
"model_id": "lightonai/LightOnOCR-1B-1025",
|
|
|
|
| 171 |
"languages": {
|
| 172 |
"evidence": "named-list",
|
| 173 |
"count": 9,
|
| 174 |
+
"named": [
|
| 175 |
+
"en",
|
| 176 |
+
"fr",
|
| 177 |
+
"de",
|
| 178 |
+
"es",
|
| 179 |
+
"it",
|
| 180 |
+
"nl",
|
| 181 |
+
"pt",
|
| 182 |
+
"sv",
|
| 183 |
+
"da"
|
| 184 |
+
],
|
| 185 |
"notes": "Explicitly European / Latin-alphabet focused."
|
| 186 |
}
|
| 187 |
},
|
|
|
|
| 194 |
"languages": {
|
| 195 |
"evidence": "named-list",
|
| 196 |
"count": 11,
|
| 197 |
+
"named": [
|
| 198 |
+
"en",
|
| 199 |
+
"fr",
|
| 200 |
+
"de",
|
| 201 |
+
"es",
|
| 202 |
+
"it",
|
| 203 |
+
"nl",
|
| 204 |
+
"pt",
|
| 205 |
+
"sv",
|
| 206 |
+
"da",
|
| 207 |
+
"zh",
|
| 208 |
+
"ja"
|
| 209 |
+
],
|
| 210 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 211 |
}
|
| 212 |
},
|
|
|
|
| 221 |
"languages": {
|
| 222 |
"evidence": "named-list",
|
| 223 |
"count": 11,
|
| 224 |
+
"named": [
|
| 225 |
+
"en",
|
| 226 |
+
"fr",
|
| 227 |
+
"de",
|
| 228 |
+
"es",
|
| 229 |
+
"it",
|
| 230 |
+
"nl",
|
| 231 |
+
"pt",
|
| 232 |
+
"sv",
|
| 233 |
+
"da",
|
| 234 |
+
"zh",
|
| 235 |
+
"ja"
|
| 236 |
+
],
|
| 237 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 238 |
}
|
| 239 |
},
|
|
|
|
| 248 |
"languages": {
|
| 249 |
"evidence": "named-list",
|
| 250 |
"count": 11,
|
| 251 |
+
"named": [
|
| 252 |
+
"en",
|
| 253 |
+
"fr",
|
| 254 |
+
"de",
|
| 255 |
+
"es",
|
| 256 |
+
"it",
|
| 257 |
+
"nl",
|
| 258 |
+
"pt",
|
| 259 |
+
"sv",
|
| 260 |
+
"da",
|
| 261 |
+
"zh",
|
| 262 |
+
"ja"
|
| 263 |
+
],
|
| 264 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 265 |
}
|
| 266 |
},
|
|
|
|
| 272 |
"task": "ocr",
|
| 273 |
"output": "markdown",
|
| 274 |
"license": "Hunyuan Community License (excludes EU/UK/KR)",
|
| 275 |
+
"languages": {
|
| 276 |
+
"evidence": "multilingual-unspecified"
|
| 277 |
+
}
|
| 278 |
},
|
| 279 |
"hunyuan-ocr-1.5.py": {
|
| 280 |
"model_id": "tencent/HunyuanOCR",
|
|
|
|
| 307 |
"task": "ocr",
|
| 308 |
"output": "markdown",
|
| 309 |
"license": "apache-2.0",
|
| 310 |
+
"languages": {
|
| 311 |
+
"evidence": "not-stated"
|
| 312 |
+
}
|
| 313 |
},
|
| 314 |
"abot-ocr.py": {
|
| 315 |
"model_id": "acvlab/ABot-OCR",
|
|
|
|
| 318 |
"image": "vllm/vllm-openai",
|
| 319 |
"task": "ocr",
|
| 320 |
"output": "markdown (text, LaTeX, HTML tables)",
|
| 321 |
+
"languages": {
|
| 322 |
+
"evidence": "not-stated"
|
| 323 |
+
}
|
| 324 |
},
|
| 325 |
"nanonets-ocr.py": {
|
| 326 |
"model_id": "nanonets/Nanonets-OCR-s",
|
|
|
|
| 328 |
"backend": "vllm",
|
| 329 |
"task": "ocr",
|
| 330 |
"output": "markdown (LaTeX, tables, forms)",
|
| 331 |
+
"languages": {
|
| 332 |
+
"evidence": "english-only"
|
| 333 |
+
}
|
| 334 |
},
|
| 335 |
"dots-mocr.py": {
|
| 336 |
"model_id": "rednote-hilab/dots.mocr",
|
|
|
|
| 338 |
"backend": "vllm",
|
| 339 |
"task": "ocr | 8 prompt modes incl. SVG, layout + bbox",
|
| 340 |
"output": "markdown",
|
| 341 |
+
"languages": {
|
| 342 |
+
"evidence": "multilingual-unspecified"
|
| 343 |
+
}
|
| 344 |
},
|
| 345 |
"nanonets-ocr2.py": {
|
| 346 |
"model_id": "nanonets/Nanonets-OCR2-3B",
|
|
|
|
| 352 |
"languages": {
|
| 353 |
"evidence": "named-list",
|
| 354 |
"count": "11 named + 'many more'",
|
| 355 |
+
"named": [
|
| 356 |
+
"en",
|
| 357 |
+
"zh",
|
| 358 |
+
"fr",
|
| 359 |
+
"es",
|
| 360 |
+
"pt",
|
| 361 |
+
"de",
|
| 362 |
+
"it",
|
| 363 |
+
"ru",
|
| 364 |
+
"ja",
|
| 365 |
+
"ko",
|
| 366 |
+
"ar"
|
| 367 |
+
],
|
| 368 |
"notes": "Only card claiming multilingual handwriting; list illustrative, no per-language benchmark."
|
| 369 |
}
|
| 370 |
},
|
|
|
|
| 375 |
"task": "ocr | 5 resolution + 5 prompt modes",
|
| 376 |
"output": "markdown",
|
| 377 |
"license": "mit",
|
| 378 |
+
"languages": {
|
| 379 |
+
"evidence": "multilingual-unspecified"
|
| 380 |
+
}
|
| 381 |
+
},
|
| 382 |
+
"jina-ocr-v1.py": {
|
| 383 |
+
"model_id": "jinaai/jina-ocr-v1",
|
| 384 |
+
"model_name": "jina-ocr-v1",
|
| 385 |
+
"params": "3.4B (MoE, ~570M active)",
|
| 386 |
+
"backend": "vllm",
|
| 387 |
+
"task": "ocr",
|
| 388 |
+
"output": "markdown",
|
| 389 |
+
"license": "cc-by-nc-4.0",
|
| 390 |
+
"notes": "DeepSeek-OCR fine-tune with a FastMTP speculative-decoding head; offline vLLM only (the checkpoint's register() must run in-process, no vllm serve path yet). Card: 91.14 OmniDocBench v1.6, 83.4 olmOCR-Bench.",
|
| 391 |
+
"languages": {
|
| 392 |
+
"evidence": "multilingual-unspecified",
|
| 393 |
+
"notes": "Card metadata says multilingual; no per-language list or evidence in the card body."
|
| 394 |
+
}
|
| 395 |
},
|
| 396 |
"deepseek-ocr.py": {
|
| 397 |
"model_id": "deepseek-ai/DeepSeek-OCR",
|
|
|
|
| 400 |
"task": "ocr",
|
| 401 |
"output": "markdown",
|
| 402 |
"license": "mit",
|
| 403 |
+
"languages": {
|
| 404 |
+
"evidence": "multilingual-unspecified"
|
| 405 |
+
}
|
| 406 |
},
|
| 407 |
"deepseek-ocr2-vllm.py": {
|
| 408 |
"model_id": "deepseek-ai/DeepSeek-OCR-2",
|
|
|
|
| 412 |
"task": "ocr",
|
| 413 |
"output": "markdown",
|
| 414 |
"license": "apache-2.0",
|
| 415 |
+
"languages": {
|
| 416 |
+
"evidence": "multilingual-unspecified"
|
| 417 |
+
}
|
| 418 |
},
|
| 419 |
"unlimited-ocr-vllm.py": {
|
| 420 |
"model_id": "baidu/Unlimited-OCR",
|
|
|
|
| 424 |
"task": "ocr (layout-grounded markdown; single-image batch)",
|
| 425 |
"output": "markdown",
|
| 426 |
"license": "mit",
|
| 427 |
+
"languages": {
|
| 428 |
+
"evidence": "multilingual-unspecified"
|
| 429 |
+
}
|
| 430 |
},
|
| 431 |
"nuextract3.py": {
|
| 432 |
"model_id": "numind/NuExtract3",
|
|
|
|
| 435 |
"image": "vllm/vllm-openai",
|
| 436 |
"task": "ocr | schema-guided extraction",
|
| 437 |
"output": "markdown or JSON",
|
| 438 |
+
"languages": {
|
| 439 |
+
"evidence": "multilingual-unspecified"
|
| 440 |
+
}
|
| 441 |
},
|
| 442 |
"qianfan-ocr.py": {
|
| 443 |
"model_id": "baidu/Qianfan-OCR",
|
|
|
|
| 457 |
"backend": "vllm",
|
| 458 |
"task": "ocr",
|
| 459 |
"output": "markdown",
|
| 460 |
+
"languages": {
|
| 461 |
+
"evidence": "english-only"
|
| 462 |
+
}
|
| 463 |
},
|
| 464 |
"rolm-ocr.py": {
|
| 465 |
"model_id": "reducto/RolmOCR",
|
|
|
|
| 467 |
"backend": "vllm",
|
| 468 |
"task": "ocr",
|
| 469 |
"output": "plain text",
|
| 470 |
+
"languages": {
|
| 471 |
+
"evidence": "not-stated"
|
| 472 |
+
}
|
| 473 |
},
|
| 474 |
"numarkdown-ocr.py": {
|
| 475 |
"model_id": "numind/NuMarkdown-8B-Thinking",
|
|
|
|
| 477 |
"backend": "vllm",
|
| 478 |
"task": "ocr (reasoning)",
|
| 479 |
"output": "markdown",
|
| 480 |
+
"languages": {
|
| 481 |
+
"evidence": "not-stated"
|
| 482 |
+
}
|
| 483 |
},
|
| 484 |
"lfm2-vl-extract.py": {
|
| 485 |
"model_id": "LiquidAI/LFM2.5-VL-1.6B-Extract",
|
|
|
|
| 503 |
"languages": {
|
| 504 |
"evidence": "named-list",
|
| 505 |
"count": 9,
|
| 506 |
+
"named": [
|
| 507 |
+
"en",
|
| 508 |
+
"ar",
|
| 509 |
+
"zh",
|
| 510 |
+
"fr",
|
| 511 |
+
"de",
|
| 512 |
+
"ja",
|
| 513 |
+
"ko",
|
| 514 |
+
"pt",
|
| 515 |
+
"es"
|
| 516 |
+
],
|
| 517 |
"notes": "Text-only model (not OCR). Card prose names 9 incl. Portuguese; card YAML lists 8 (pt missing)."
|
| 518 |
}
|
| 519 |
},
|
|
|
|
| 524 |
"task": "schema-guided extraction (image or multi-page PDF -> JSON)",
|
| 525 |
"output": "JSON",
|
| 526 |
"license": "modified OpenRAIL-M",
|
| 527 |
+
"languages": {
|
| 528 |
+
"evidence": "not-stated"
|
| 529 |
+
}
|
| 530 |
},
|
| 531 |
"pp-doclayout.py": {
|
| 532 |
"model_id": "PaddlePaddle/PP-DocLayout-L",
|
|
|
|
| 534 |
"backend": "paddleocr",
|
| 535 |
"task": "layout detection (no text extraction)",
|
| 536 |
"output": "bounding boxes + region classes",
|
| 537 |
+
"languages": {
|
| 538 |
+
"evidence": "not-applicable"
|
| 539 |
+
}
|
| 540 |
+
},
|
| 541 |
+
"glm-ocr-v2.py": {
|
| 542 |
+
"variant_of": "glm-ocr.py",
|
| 543 |
+
"notes": "Adds checkpoint/resume for very large jobs."
|
| 544 |
+
},
|
| 545 |
+
"glm-ocr-bucket.py": {
|
| 546 |
+
"variant_of": "glm-ocr.py",
|
| 547 |
+
"notes": "Reads images/PDFs from a mounted bucket, writes one .md per page."
|
| 548 |
+
},
|
| 549 |
+
"falcon-ocr-bucket.py": {
|
| 550 |
+
"variant_of": "falcon-ocr.py",
|
| 551 |
+
"notes": "Reads images/PDFs from a mounted bucket, writes one .md per page."
|
| 552 |
},
|
| 553 |
+
"surya-ocr-bucket.py": {
|
| 554 |
+
"variant_of": "surya-ocr.py",
|
| 555 |
+
"notes": "Bucket-to-bucket structured OCR (--io-mode mount|copy), resumable."
|
| 556 |
+
},
|
| 557 |
+
"ocr-vllm-judge.py": {
|
| 558 |
+
"model_id": "configurable",
|
| 559 |
+
"task": "pairwise OCR-quality judging (VLM-as-judge)",
|
| 560 |
+
"languages": {
|
| 561 |
+
"evidence": "not-applicable"
|
| 562 |
+
}
|
| 563 |
+
}
|
| 564 |
}
|