Sync from GitHub via hub-sync
Browse files- CLAUDE.md +9 -2
- lighton-ocr2.py +18 -1
- models.json +4 -2
CLAUDE.md
CHANGED
|
@@ -46,7 +46,10 @@ planned **self-review skill** (see [Deferred](#deferred--tracked)) just enforces
|
|
| 46 |
wheel, a resolver backtrack. In the recipe, record **why** the pin exists and **what would loosen it**
|
| 47 |
(e.g. "move back to the default image when a newer vLLM ships a Qwen2.5-VL decode fix"; "drop the
|
| 48 |
nightly once the arch lands in a stable release"). Re-test periodically and relax when the gap closes —
|
| 49 |
-
that's what the `
|
|
|
|
|
|
|
|
|
|
| 50 |
- **Env guards on the bare image.** Set `VLLM_USE_FLASHINFER_SAMPLER=0` (and `VLLM_USE_DEEP_GEMM=0`
|
| 51 |
for nightly vLLM) **before** importing `vllm` — both JIT paths need `nvcc`, which the bare uv image lacks.
|
| 52 |
- **Context-length invariant.** `--max-tokens` ≤ `--max-model-len` ≤ the model's real max context
|
|
@@ -63,6 +66,10 @@ planned **self-review skill** (see [Deferred](#deferred--tracked)) just enforces
|
|
| 63 |
don't auto-size `max_model_len` from images (it's fixed at engine init, before images are seen).
|
| 64 |
- **Dep sanity.** No stale version *caps* that drag a transitive lib back — e.g. `pyarrow<18` forced an
|
| 65 |
old `datasets` lacking the `Json` feature → `load_dataset` crashed (the glm-ocr bug). Use floors, not ceilings.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
- **Error signalling (known gap).** Scripts currently write sentinels (`[OCR ERROR]`, `[SURYA GENERATE
|
| 67 |
ERROR]`) *into* the output column, so partial failures are silent. A companion `ocr_error` status
|
| 68 |
column is the deferred fix (see [Deferred](#deferred--tracked)).
|
|
@@ -357,7 +364,7 @@ LightOnOCR-2's commentary style).
|
|
| 357 |
|
| 358 |
- **bucketbag adoption** — evaluate adopting `bucketbag` for the bucket recipes (slim recipes / harden
|
| 359 |
bucketbag / find other beneficiaries) → [#67](https://github.com/davanstrien/uv-scripts/issues/67).
|
| 360 |
-
- **Self-review skill** (spark) — a dev-only skill (sibling to `
|
| 361 |
against the [Conventions](#conventions--invariants) block: context-length, collision guard, vLLM-image +
|
| 362 |
preflight, env guards, dep sanity, image bounding, optional Jobs smoke. Enforces that list; build after
|
| 363 |
the current work.
|
|
|
|
| 46 |
wheel, a resolver backtrack. In the recipe, record **why** the pin exists and **what would loosen it**
|
| 47 |
(e.g. "move back to the default image when a newer vLLM ships a Qwen2.5-VL decode fix"; "drop the
|
| 48 |
nightly once the arch lands in a stable release"). Re-test periodically and relax when the gap closes —
|
| 49 |
+
that's what the `maintain-recipes` skill is for; prefer floors over exact pins once you can.
|
| 50 |
+
This applies to **active** recipes. **Frozen** recipes (superseded or little used) pin image digest,
|
| 51 |
+
package cutoff and model revision on purpose and get fixes only when they break — see
|
| 52 |
+
[MAINTAINING.md](https://github.com/davanstrien/uv-scripts/blob/main/MAINTAINING.md).
|
| 53 |
- **Env guards on the bare image.** Set `VLLM_USE_FLASHINFER_SAMPLER=0` (and `VLLM_USE_DEEP_GEMM=0`
|
| 54 |
for nightly vLLM) **before** importing `vllm` — both JIT paths need `nvcc`, which the bare uv image lacks.
|
| 55 |
- **Context-length invariant.** `--max-tokens` ≤ `--max-model-len` ≤ the model's real max context
|
|
|
|
| 66 |
don't auto-size `max_model_len` from images (it's fixed at engine init, before images are seen).
|
| 67 |
- **Dep sanity.** No stale version *caps* that drag a transitive lib back — e.g. `pyarrow<18` forced an
|
| 68 |
old `datasets` lacking the `Json` feature → `load_dataset` crashed (the glm-ocr bug). Use floors, not ceilings.
|
| 69 |
+
**Exception: image limits.** On a pinned image the image's copy of a shared package wins over uv's, so a
|
| 70 |
+
cap that encodes what the image ships is correct (e.g. `datasets<5.1` because 5.1 needs
|
| 71 |
+
`huggingface_hub>=1.31` and images before v0.30 ship older). Comment the reason next to the cap
|
| 72 |
+
([MAINTAINING.md](https://github.com/davanstrien/uv-scripts/blob/main/MAINTAINING.md), "Image-mode recipes").
|
| 73 |
- **Error signalling (known gap).** Scripts currently write sentinels (`[OCR ERROR]`, `[SURYA GENERATE
|
| 74 |
ERROR]`) *into* the output column, so partial failures are silent. A companion `ocr_error` status
|
| 75 |
column is the deferred fix (see [Deferred](#deferred--tracked)).
|
|
|
|
| 364 |
|
| 365 |
- **bucketbag adoption** — evaluate adopting `bucketbag` for the bucket recipes (slim recipes / harden
|
| 366 |
bucketbag / find other beneficiaries) → [#67](https://github.com/davanstrien/uv-scripts/issues/67).
|
| 367 |
+
- **Self-review skill** (spark) — a dev-only skill (sibling to `maintain-recipes`) that reviews a recipe/diff
|
| 368 |
against the [Conventions](#conventions--invariants) block: context-length, collision guard, vLLM-image +
|
| 369 |
preflight, env guards, dep sanity, image bounding, optional Jobs smoke. Enforces that list; build after
|
| 370 |
the current work.
|
lighton-ocr2.py
CHANGED
|
@@ -8,8 +8,16 @@
|
|
| 8 |
# "toolz",
|
| 9 |
# ]
|
| 10 |
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# [tool.hf-jobs]
|
| 12 |
-
# image = "vllm/vllm-openai:v0.22.1
|
| 13 |
# python = "/usr/bin/python3"
|
| 14 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 15 |
# flavor = "a10g-small"
|
|
@@ -35,6 +43,10 @@ fails to import LightOnOCR-2 (PixtralRotaryEmbedding). Pass --timeout for a long
|
|
| 35 |
|
| 36 |
To run on your own GPU, add the engine: `uv run --with vllm==0.22.1 lighton-ocr2.py ...`.
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
Features:
|
| 39 |
- ⚡ Fastest: 42.8 pages/sec on H100 GPU (7× faster than v1)
|
| 40 |
- 🎯 High accuracy: 83.2 ± 0.9% on OlmOCR-Bench (+7.1% vs v1)
|
|
@@ -79,6 +91,8 @@ logger = logging.getLogger(__name__)
|
|
| 79 |
|
| 80 |
# LightOnOCR-2 model (single variant)
|
| 81 |
MODEL = "lightonai/LightOnOCR-2-1B"
|
|
|
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
def check_cuda_availability():
|
|
@@ -371,6 +385,9 @@ def main(
|
|
| 371 |
logger.info("This may take a few minutes on first run...")
|
| 372 |
llm = LLM(
|
| 373 |
model=MODEL,
|
|
|
|
|
|
|
|
|
|
| 374 |
trust_remote_code=True,
|
| 375 |
max_model_len=max_model_len,
|
| 376 |
gpu_memory_utilization=gpu_memory_utilization,
|
|
|
|
| 8 |
# "toolz",
|
| 9 |
# ]
|
| 10 |
#
|
| 11 |
+
# [tool.uv]
|
| 12 |
+
# exclude-newer = "2026-10-01T00:00:00Z" # frozen: resolve packages as on this date
|
| 13 |
+
#
|
| 14 |
+
# [tool.uv-scripts]
|
| 15 |
+
# maintenance = "frozen"
|
| 16 |
+
# frozen_on = "2026-11-06"
|
| 17 |
+
# superseded_by = "lighton-ocr3.py"
|
| 18 |
+
#
|
| 19 |
# [tool.hf-jobs]
|
| 20 |
+
# image = "vllm/vllm-openai@sha256:953d3a06d5e64ab582985cd7401289d3abf2a2c14ef2158e9a84313daeec77d7" # v0.22.1
|
| 21 |
# python = "/usr/bin/python3"
|
| 22 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 23 |
# flavor = "a10g-small"
|
|
|
|
| 43 |
|
| 44 |
To run on your own GPU, add the engine: `uv run --with vllm==0.22.1 lighton-ocr2.py ...`.
|
| 45 |
|
| 46 |
+
Frozen on 2026-11-06 (superseded by lighton-ocr3.py): the image digest, the package
|
| 47 |
+
resolution date and the model revision are pinned, and it gets fixes only when it breaks.
|
| 48 |
+
See MAINTAINING.md in https://github.com/davanstrien/uv-scripts.
|
| 49 |
+
|
| 50 |
Features:
|
| 51 |
- ⚡ Fastest: 42.8 pages/sec on H100 GPU (7× faster than v1)
|
| 52 |
- 🎯 High accuracy: 83.2 ± 0.9% on OlmOCR-Bench (+7.1% vs v1)
|
|
|
|
| 91 |
|
| 92 |
# LightOnOCR-2 model (single variant)
|
| 93 |
MODEL = "lightonai/LightOnOCR-2-1B"
|
| 94 |
+
# Frozen: the revision tested on 2026-11-06 (main at that date).
|
| 95 |
+
MODEL_REVISION = "be7c41313c30e940fe5571de59e5fabc779e00c8"
|
| 96 |
|
| 97 |
|
| 98 |
def check_cuda_availability():
|
|
|
|
| 385 |
logger.info("This may take a few minutes on first run...")
|
| 386 |
llm = LLM(
|
| 387 |
model=MODEL,
|
| 388 |
+
revision=MODEL_REVISION,
|
| 389 |
+
code_revision=MODEL_REVISION,
|
| 390 |
+
tokenizer_revision=MODEL_REVISION,
|
| 391 |
trust_remote_code=True,
|
| 392 |
max_model_len=max_model_len,
|
| 393 |
gpu_memory_utilization=gpu_memory_utilization,
|
models.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"_meta": {
|
| 3 |
"description": "Machine-readable catalog of the OCR recipes in this directory: script -> model, params, backend, support level, the tested Jobs launch config (the script's [tool.hf-jobs] header), and what the model's own card claims about language coverage. Human-readable language notes: LANGUAGES.md. Language evidence levels, strongest first: per-language-benchmark | count-claim | named-list | multilingual-unspecified | english-only | not-stated | not-applicable. Claims come from model cards (compiled 2026-07-15) - treat as claims, not guarantees.",
|
| 4 |
-
"updated": "2026-11-
|
| 5 |
"run_pattern": "hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/<script> <input-dataset> <output-dataset> (hf CLI >= 1.32 reads image/flavor/secrets from the script's [tool.hf-jobs] header; add --timeout for long runs. Scripts without a `jobs` entry need --flavor/-s HF_TOKEN (and any --image in their docstring).)",
|
| 6 |
"support_levels": {
|
| 7 |
"core": "Maintained. Smoke-tested flagless on HF Jobs on 2026-09-23/24 with the pinned launch config in `jobs`.",
|
|
@@ -325,8 +325,10 @@
|
|
| 325 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 326 |
},
|
| 327 |
"support": "core",
|
|
|
|
|
|
|
| 328 |
"jobs": {
|
| 329 |
-
"image": "vllm/vllm-openai:
|
| 330 |
"python": "/usr/bin/python3",
|
| 331 |
"env": {
|
| 332 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
|
|
| 1 |
{
|
| 2 |
"_meta": {
|
| 3 |
"description": "Machine-readable catalog of the OCR recipes in this directory: script -> model, params, backend, support level, the tested Jobs launch config (the script's [tool.hf-jobs] header), and what the model's own card claims about language coverage. Human-readable language notes: LANGUAGES.md. Language evidence levels, strongest first: per-language-benchmark | count-claim | named-list | multilingual-unspecified | english-only | not-stated | not-applicable. Claims come from model cards (compiled 2026-07-15) - treat as claims, not guarantees.",
|
| 4 |
+
"updated": "2026-11-06",
|
| 5 |
"run_pattern": "hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/<script> <input-dataset> <output-dataset> (hf CLI >= 1.32 reads image/flavor/secrets from the script's [tool.hf-jobs] header; add --timeout for long runs. Scripts without a `jobs` entry need --flavor/-s HF_TOKEN (and any --image in their docstring).)",
|
| 6 |
"support_levels": {
|
| 7 |
"core": "Maintained. Smoke-tested flagless on HF Jobs on 2026-09-23/24 with the pinned launch config in `jobs`.",
|
|
|
|
| 325 |
"notes": "Adds zh/ja over v1; declared, not benchmarked per language."
|
| 326 |
},
|
| 327 |
"support": "core",
|
| 328 |
+
"support_note": "Frozen 2026-11-06 (superseded by lighton-ocr3.py): image digest, package cutoff and model revision pinned; fixed only when it breaks. Use lighton-ocr3.py for new runs.",
|
| 329 |
+
"revision": "be7c41313c30e940fe5571de59e5fabc779e00c8",
|
| 330 |
"jobs": {
|
| 331 |
+
"image": "vllm/vllm-openai@sha256:953d3a06d5e64ab582985cd7401289d3abf2a2c14ef2158e9a84313daeec77d7",
|
| 332 |
"python": "/usr/bin/python3",
|
| 333 |
"env": {
|
| 334 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|