Sync from GitHub via hub-sync
Browse files- lighton-ocr2-saturate.py +2 -2
- lighton-ocr2.py +20 -7
lighton-ocr2-saturate.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
# ]
|
| 7 |
#
|
| 8 |
# [tool.hf-jobs]
|
| 9 |
-
# image = "vllm/vllm-openai:
|
| 10 |
# flavor = "a10g-small"
|
| 11 |
# secrets = ["HF_TOKEN"]
|
| 12 |
# ///
|
|
@@ -71,7 +71,7 @@ import sys
|
|
| 71 |
# Throughput receipt (a10g-small): 0.955 img/s at 1k pages incl. streaming.
|
| 72 |
SERVING = {
|
| 73 |
"model": "lightonai/LightOnOCR-2-1B",
|
| 74 |
-
"image": "vllm/vllm-openai:
|
| 75 |
"max_model_len": 8192,
|
| 76 |
"serve_args": [
|
| 77 |
"--limit-mm-per-prompt", '{"image": 1}',
|
|
|
|
| 6 |
# ]
|
| 7 |
#
|
| 8 |
# [tool.hf-jobs]
|
| 9 |
+
# image = "vllm/vllm-openai:v0.22.1"
|
| 10 |
# flavor = "a10g-small"
|
| 11 |
# secrets = ["HF_TOKEN"]
|
| 12 |
# ///
|
|
|
|
| 71 |
# Throughput receipt (a10g-small): 0.955 img/s at 1k pages incl. streaming.
|
| 72 |
SERVING = {
|
| 73 |
"model": "lightonai/LightOnOCR-2-1B",
|
| 74 |
+
"image": "vllm/vllm-openai:v0.22.1",
|
| 75 |
"max_model_len": 8192,
|
| 76 |
"serve_args": [
|
| 77 |
"--limit-mm-per-prompt", '{"image": 1}',
|
lighton-ocr2.py
CHANGED
|
@@ -4,11 +4,16 @@
|
|
| 4 |
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
-
# "vllm>=0.15.1",
|
| 8 |
# "tqdm",
|
| 9 |
# "toolz",
|
| 10 |
-
# "torch",
|
| 11 |
# ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# ///
|
| 13 |
|
| 14 |
"""
|
|
@@ -18,8 +23,16 @@ LightOnOCR-2 is a compact 1B multilingual OCR model optimized for production spe
|
|
| 18 |
Combines Pixtral ViT encoder with Qwen3 language model for efficient document parsing.
|
| 19 |
Uses Reinforcement Learning with Verifiable Rewards (RLVR) for improved quality.
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
Features:
|
| 25 |
- ⚡ Fastest: 42.8 pages/sec on H100 GPU (7× faster than v1)
|
|
@@ -33,7 +46,7 @@ Features:
|
|
| 33 |
- 💪 Production-ready: Outperforms models 9× larger
|
| 34 |
|
| 35 |
Model: lightonai/LightOnOCR-2-1B
|
| 36 |
-
vLLM:
|
| 37 |
Performance: 83.2 ± 0.9% on OlmOCR-Bench
|
| 38 |
"""
|
| 39 |
|
|
@@ -530,8 +543,8 @@ if __name__ == "__main__":
|
|
| 530 |
print("\n4. Original image size (no resize):")
|
| 531 |
print(" uv run lighton-ocr2.py docs output --no-resize")
|
| 532 |
print("\n5. Running on HF Jobs:")
|
| 533 |
-
print("
|
| 534 |
-
print("
|
| 535 |
print(
|
| 536 |
" https://huggingface.co/datasets/uv-scripts/ocr/raw/main/lighton-ocr2.py \\"
|
| 537 |
)
|
|
|
|
| 4 |
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
|
|
|
| 7 |
# "tqdm",
|
| 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"
|
| 16 |
+
# secrets = ["HF_TOKEN"]
|
| 17 |
# ///
|
| 18 |
|
| 19 |
"""
|
|
|
|
| 23 |
Combines Pixtral ViT encoder with Qwen3 language model for efficient document parsing.
|
| 24 |
Uses Reinforcement Learning with Verifiable Rewards (RLVR) for improved quality.
|
| 25 |
|
| 26 |
+
Run on HF Jobs. vLLM and torch come from the vllm/vllm-openai:v0.22.1 image declared
|
| 27 |
+
in the [tool.hf-jobs] header (`hf` CLI 1.32+), which also sets the hardware and the
|
| 28 |
+
HF_TOKEN secret. The tag is pinned: unpinned vLLM 0.29/0.30 with current transformers
|
| 29 |
+
fails to import LightOnOCR-2 (PixtralRotaryEmbedding). Pass --timeout for a long run:
|
| 30 |
+
|
| 31 |
+
hf jobs uv run --timeout 1h \\
|
| 32 |
+
https://huggingface.co/datasets/uv-scripts/ocr/raw/main/lighton-ocr2.py \\
|
| 33 |
+
<input-dataset> <output-dataset>
|
| 34 |
+
|
| 35 |
+
To run on your own GPU, add the engine: `uv run --with vllm==0.22.1 lighton-ocr2.py ...`.
|
| 36 |
|
| 37 |
Features:
|
| 38 |
- ⚡ Fastest: 42.8 pages/sec on H100 GPU (7× faster than v1)
|
|
|
|
| 46 |
- 💪 Production-ready: Outperforms models 9× larger
|
| 47 |
|
| 48 |
Model: lightonai/LightOnOCR-2-1B
|
| 49 |
+
vLLM: vllm/vllm-openai:v0.22.1 image (see the header)
|
| 50 |
Performance: 83.2 ± 0.9% on OlmOCR-Bench
|
| 51 |
"""
|
| 52 |
|
|
|
|
| 543 |
print("\n4. Original image size (no resize):")
|
| 544 |
print(" uv run lighton-ocr2.py docs output --no-resize")
|
| 545 |
print("\n5. Running on HF Jobs:")
|
| 546 |
+
print(" (image, hardware and HF_TOKEN come from the script's [tool.hf-jobs] header)")
|
| 547 |
+
print(" hf jobs uv run \\")
|
| 548 |
print(
|
| 549 |
" https://huggingface.co/datasets/uv-scripts/ocr/raw/main/lighton-ocr2.py \\"
|
| 550 |
)
|