Sync from GitHub via hub-sync
Browse files- README.md +3 -3
- dots-mocr.py +14 -17
- dots-ocr.py +12 -16
- glm-ocr.py +15 -13
- models.json +7 -7
README.md
CHANGED
|
@@ -24,7 +24,7 @@ hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.p
|
|
| 24 |
|
| 25 |
The Job adds a `markdown` column to all seven rows and saves them in `your-username/ocr-demo-results`. Dependency installation and model loading can take a few minutes before OCR starts. The [dataset card](https://huggingface.co/datasets/uv-scripts/ocr-demo) gives the source and licence.
|
| 26 |
|
| 27 |
-
> **Note:** the command needs no flags because the script's [`[tool.hf-jobs]` header](https://huggingface.co/docs/hub/jobs-configuration#define-the-launch-config-in-the-script) sets the GPU, the Docker image and the `HF_TOKEN` secret. The `hf` CLI reads the header from version 1.32. `hf jobs uv run --dry-run <script>` shows the resolved settings. Flags override the header, for example `--timeout 1h` for a larger dataset or `--flavor` for other hardware. **Older CLIs ignore the header without a warning**, and the Job then fails on a CPU without your token. Check with `hf version` and upgrade. If you cannot upgrade, copy the header values from the top of the script (or from `jobs` in [`models.json`](models.json)) as flags. For `glm-ocr.py` that is `--flavor a10g-small --secrets HF_TOKEN --image vllm/vllm-openai:v0.
|
| 28 |
|
| 29 |
### Try the same pages as a PDF
|
| 30 |
|
|
@@ -259,7 +259,7 @@ job = run_uv_job(
|
|
| 259 |
"https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py",
|
| 260 |
script_args=["input-dataset", "output-dataset", "--max-samples", "10"],
|
| 261 |
flavor="a10g-small",
|
| 262 |
-
image="vllm/vllm-openai:v0.
|
| 263 |
python="/usr/bin/python3",
|
| 264 |
env={"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"},
|
| 265 |
secrets={"HF_TOKEN": get_token()},
|
|
@@ -280,7 +280,7 @@ nvrtc: error: failed to open libnvrtc-builtins.so...
|
|
| 280 |
The Job ran on the default image, which has no CUDA toolkit. This happens with an older CLI, with a legacy recipe, or when you override `--image`. Run it on the `vllm/vllm-openai` image:
|
| 281 |
|
| 282 |
```bash
|
| 283 |
-
--image vllm/vllm-openai:v0.
|
| 284 |
```
|
| 285 |
|
| 286 |
Use the tag from the script's header. The Surya recipes use `/usr/local/bin/python3` and `site-packages` instead; copy their header exactly. `unlimited-ocr-vllm.py` needs Baidu's `vllm/vllm-openai:unlimited-ocr` image (`:unlimited-ocr-cu129` on H100 or H200).
|
|
|
|
| 24 |
|
| 25 |
The Job adds a `markdown` column to all seven rows and saves them in `your-username/ocr-demo-results`. Dependency installation and model loading can take a few minutes before OCR starts. The [dataset card](https://huggingface.co/datasets/uv-scripts/ocr-demo) gives the source and licence.
|
| 26 |
|
| 27 |
+
> **Note:** the command needs no flags because the script's [`[tool.hf-jobs]` header](https://huggingface.co/docs/hub/jobs-configuration#define-the-launch-config-in-the-script) sets the GPU, the Docker image and the `HF_TOKEN` secret. The `hf` CLI reads the header from version 1.32. `hf jobs uv run --dry-run <script>` shows the resolved settings. Flags override the header, for example `--timeout 1h` for a larger dataset or `--flavor` for other hardware. **Older CLIs ignore the header without a warning**, and the Job then fails on a CPU without your token. Check with `hf version` and upgrade. If you cannot upgrade, copy the header values from the top of the script (or from `jobs` in [`models.json`](models.json)) as flags. For `glm-ocr.py` that is `--flavor a10g-small --secrets HF_TOKEN --image vllm/vllm-openai:v0.30.0 --python /usr/bin/python3 -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages`.
|
| 28 |
|
| 29 |
### Try the same pages as a PDF
|
| 30 |
|
|
|
|
| 259 |
"https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py",
|
| 260 |
script_args=["input-dataset", "output-dataset", "--max-samples", "10"],
|
| 261 |
flavor="a10g-small",
|
| 262 |
+
image="vllm/vllm-openai:v0.30.0",
|
| 263 |
python="/usr/bin/python3",
|
| 264 |
env={"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"},
|
| 265 |
secrets={"HF_TOKEN": get_token()},
|
|
|
|
| 280 |
The Job ran on the default image, which has no CUDA toolkit. This happens with an older CLI, with a legacy recipe, or when you override `--image`. Run it on the `vllm/vllm-openai` image:
|
| 281 |
|
| 282 |
```bash
|
| 283 |
+
--image vllm/vllm-openai:v0.30.0 --python /usr/bin/python3 -e PYTHONPATH=/usr/local/lib/python3.12/dist-packages
|
| 284 |
```
|
| 285 |
|
| 286 |
Use the tag from the script's header. The Surya recipes use `/usr/local/bin/python3` and `site-packages` instead; copy their header exactly. `unlimited-ocr-vllm.py` needs Baidu's `vllm/vllm-openai:unlimited-ocr` image (`:unlimited-ocr-cu129` on H100 or H200).
|
dots-mocr.py
CHANGED
|
@@ -6,15 +6,12 @@
|
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
| 8 |
# "toolz",
|
| 9 |
-
# # dots.mocr's remote code (AutoProcessor.register with a string key)
|
| 10 |
-
# # breaks on transformers v5; vllm pulls transformers unpinned.
|
| 11 |
-
# # Local `uv run --with vllm==...` only: on Jobs the header image's own
|
| 12 |
-
# # transformers wins via PYTHONPATH, so this pin has no effect there.
|
| 13 |
-
# "transformers<5",
|
| 14 |
# ]
|
| 15 |
#
|
| 16 |
# [tool.hf-jobs]
|
| 17 |
-
#
|
|
|
|
|
|
|
| 18 |
# python = "/usr/bin/python3"
|
| 19 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 20 |
# flavor = "a10g-small"
|
|
@@ -52,7 +49,7 @@ needs the hf CLI 1.32+):
|
|
| 52 |
|
| 53 |
On your own GPU, vLLM is not in the dependencies (the Jobs image provides it):
|
| 54 |
|
| 55 |
-
uv run --with vllm==0.
|
| 56 |
"""
|
| 57 |
|
| 58 |
import argparse
|
|
@@ -581,15 +578,15 @@ if __name__ == "__main__":
|
|
| 581 |
print(" general - Free-form (use with --custom-prompt)")
|
| 582 |
print("\nExample usage:")
|
| 583 |
print("\n1. Basic OCR:")
|
| 584 |
-
print(" uv run --with vllm==0.
|
| 585 |
print("\n2. SVG generation:")
|
| 586 |
print(
|
| 587 |
-
" uv run --with vllm==0.
|
| 588 |
)
|
| 589 |
print("\n3. Web screen parsing:")
|
| 590 |
-
print(" uv run --with vllm==0.
|
| 591 |
print("\n4. Layout analysis with structure:")
|
| 592 |
-
print(" uv run --with vllm==0.
|
| 593 |
print("\n5. Running on HF Jobs:")
|
| 594 |
print(" # [tool.hf-jobs] header sets image/flavor/secrets (hf CLI 1.32+)")
|
| 595 |
print(" hf jobs uv run \\")
|
|
@@ -598,7 +595,7 @@ if __name__ == "__main__":
|
|
| 598 |
)
|
| 599 |
print(" input-dataset output-dataset")
|
| 600 |
print("\n" + "=" * 80)
|
| 601 |
-
print("\nFor full help, run: uv run --with vllm==0.
|
| 602 |
sys.exit(0)
|
| 603 |
|
| 604 |
parser = argparse.ArgumentParser(
|
|
@@ -622,19 +619,19 @@ SVG Code Generation:
|
|
| 622 |
|
| 623 |
Examples:
|
| 624 |
# Basic text OCR (default)
|
| 625 |
-
uv run --with vllm==0.
|
| 626 |
|
| 627 |
# SVG generation with optimized variant
|
| 628 |
-
uv run --with vllm==0.
|
| 629 |
|
| 630 |
# Web screen parsing
|
| 631 |
-
uv run --with vllm==0.
|
| 632 |
|
| 633 |
# Full layout analysis with structure
|
| 634 |
-
uv run --with vllm==0.
|
| 635 |
|
| 636 |
# Random sampling for testing
|
| 637 |
-
uv run --with vllm==0.
|
| 638 |
""",
|
| 639 |
)
|
| 640 |
|
|
|
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
| 8 |
# "toolz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# ]
|
| 10 |
#
|
| 11 |
# [tool.hf-jobs]
|
| 12 |
+
# # >=v0.30.0: ships huggingface_hub>=1.31, which datasets>=5.1 imports (httpx). On v0.29.0,
|
| 13 |
+
# # PYTHONPATH puts the image's older hub first and `import datasets` crashes.
|
| 14 |
+
# image = "vllm/vllm-openai:v0.30.0"
|
| 15 |
# python = "/usr/bin/python3"
|
| 16 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 17 |
# flavor = "a10g-small"
|
|
|
|
| 49 |
|
| 50 |
On your own GPU, vLLM is not in the dependencies (the Jobs image provides it):
|
| 51 |
|
| 52 |
+
uv run --with vllm==0.30.0 dots-mocr.py input-dataset output-dataset
|
| 53 |
"""
|
| 54 |
|
| 55 |
import argparse
|
|
|
|
| 578 |
print(" general - Free-form (use with --custom-prompt)")
|
| 579 |
print("\nExample usage:")
|
| 580 |
print("\n1. Basic OCR:")
|
| 581 |
+
print(" uv run --with vllm==0.30.0 dots-mocr.py input-dataset output-dataset")
|
| 582 |
print("\n2. SVG generation:")
|
| 583 |
print(
|
| 584 |
+
" uv run --with vllm==0.30.0 dots-mocr.py charts svg-output --prompt-mode svg --model rednote-hilab/dots.mocr-svg"
|
| 585 |
)
|
| 586 |
print("\n3. Web screen parsing:")
|
| 587 |
+
print(" uv run --with vllm==0.30.0 dots-mocr.py screenshots parsed --prompt-mode web-parsing")
|
| 588 |
print("\n4. Layout analysis with structure:")
|
| 589 |
+
print(" uv run --with vllm==0.30.0 dots-mocr.py papers analyzed --prompt-mode layout-all")
|
| 590 |
print("\n5. Running on HF Jobs:")
|
| 591 |
print(" # [tool.hf-jobs] header sets image/flavor/secrets (hf CLI 1.32+)")
|
| 592 |
print(" hf jobs uv run \\")
|
|
|
|
| 595 |
)
|
| 596 |
print(" input-dataset output-dataset")
|
| 597 |
print("\n" + "=" * 80)
|
| 598 |
+
print("\nFor full help, run: uv run --with vllm==0.30.0 dots-mocr.py --help")
|
| 599 |
sys.exit(0)
|
| 600 |
|
| 601 |
parser = argparse.ArgumentParser(
|
|
|
|
| 619 |
|
| 620 |
Examples:
|
| 621 |
# Basic text OCR (default)
|
| 622 |
+
uv run --with vllm==0.30.0 dots-mocr.py my-docs analyzed-docs
|
| 623 |
|
| 624 |
# SVG generation with optimized variant
|
| 625 |
+
uv run --with vllm==0.30.0 dots-mocr.py charts svg-out --prompt-mode svg --model rednote-hilab/dots.mocr-svg
|
| 626 |
|
| 627 |
# Web screen parsing
|
| 628 |
+
uv run --with vllm==0.30.0 dots-mocr.py screenshots parsed --prompt-mode web-parsing
|
| 629 |
|
| 630 |
# Full layout analysis with structure
|
| 631 |
+
uv run --with vllm==0.30.0 dots-mocr.py papers structured --prompt-mode layout-all
|
| 632 |
|
| 633 |
# Random sampling for testing
|
| 634 |
+
uv run --with vllm==0.30.0 dots-mocr.py large-dataset test --max-samples 50 --shuffle
|
| 635 |
""",
|
| 636 |
)
|
| 637 |
|
dots-ocr.py
CHANGED
|
@@ -6,16 +6,12 @@
|
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
| 8 |
# "toolz",
|
| 9 |
-
# # dots.ocr's remote code (AutoProcessor.register with a string key)
|
| 10 |
-
# # breaks on transformers v5; vllm pulls transformers unpinned.
|
| 11 |
-
# # Same fix as dots-mocr (#76).
|
| 12 |
-
# # Local `uv run --with vllm==...` only: on Jobs the header image's own
|
| 13 |
-
# # transformers wins via PYTHONPATH, so this pin has no effect there.
|
| 14 |
-
# "transformers<5",
|
| 15 |
# ]
|
| 16 |
#
|
| 17 |
# [tool.hf-jobs]
|
| 18 |
-
#
|
|
|
|
|
|
|
| 19 |
# python = "/usr/bin/python3"
|
| 20 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 21 |
# flavor = "a10g-small"
|
|
@@ -46,7 +42,7 @@ needs `hf` CLI 1.32+):
|
|
| 46 |
|
| 47 |
Run on your own GPU (vLLM and torch come from the image on Jobs, so add them):
|
| 48 |
|
| 49 |
-
uv run --with vllm==0.
|
| 50 |
"""
|
| 51 |
|
| 52 |
import argparse
|
|
@@ -494,17 +490,17 @@ if __name__ == "__main__":
|
|
| 494 |
print("- 📝 Layout-aware text extraction")
|
| 495 |
print("\nExample usage:")
|
| 496 |
print("\n1. Basic OCR:")
|
| 497 |
-
print(" uv run --with vllm==0.
|
| 498 |
print("\n2. With custom settings:")
|
| 499 |
print(
|
| 500 |
-
" uv run --with vllm==0.
|
| 501 |
)
|
| 502 |
print("\n3. Layout analysis with structure:")
|
| 503 |
print(
|
| 504 |
-
" uv run --with vllm==0.
|
| 505 |
)
|
| 506 |
print("\n4. Layout detection only (no text):")
|
| 507 |
-
print(" uv run --with vllm==0.
|
| 508 |
print("\n5. Running on HF Jobs (header sets image/flavor/secrets; hf CLI 1.32+):")
|
| 509 |
print(" hf jobs uv run \\")
|
| 510 |
print(
|
|
@@ -512,7 +508,7 @@ if __name__ == "__main__":
|
|
| 512 |
)
|
| 513 |
print(" input-dataset output-dataset")
|
| 514 |
print("\n" + "=" * 80)
|
| 515 |
-
print("\nFor full help, run: uv run --with vllm==0.
|
| 516 |
sys.exit(0)
|
| 517 |
|
| 518 |
parser = argparse.ArgumentParser(
|
|
@@ -526,13 +522,13 @@ Prompt Modes (official DoTS.ocr prompts):
|
|
| 526 |
|
| 527 |
Examples:
|
| 528 |
# Basic text OCR (default)
|
| 529 |
-
uv run --with vllm==0.
|
| 530 |
|
| 531 |
# Full layout analysis with structure
|
| 532 |
-
uv run --with vllm==0.
|
| 533 |
|
| 534 |
# Random sampling for testing
|
| 535 |
-
uv run --with vllm==0.
|
| 536 |
""",
|
| 537 |
)
|
| 538 |
|
|
|
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
| 8 |
# "toolz",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# ]
|
| 10 |
#
|
| 11 |
# [tool.hf-jobs]
|
| 12 |
+
# # >=v0.30.0: ships huggingface_hub>=1.31, which datasets>=5.1 imports (httpx). On v0.29.0,
|
| 13 |
+
# # PYTHONPATH puts the image's older hub first and `import datasets` crashes.
|
| 14 |
+
# image = "vllm/vllm-openai:v0.30.0"
|
| 15 |
# python = "/usr/bin/python3"
|
| 16 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 17 |
# flavor = "a10g-small"
|
|
|
|
| 42 |
|
| 43 |
Run on your own GPU (vLLM and torch come from the image on Jobs, so add them):
|
| 44 |
|
| 45 |
+
uv run --with vllm==0.30.0 dots-ocr.py input-dataset output-dataset
|
| 46 |
"""
|
| 47 |
|
| 48 |
import argparse
|
|
|
|
| 490 |
print("- 📝 Layout-aware text extraction")
|
| 491 |
print("\nExample usage:")
|
| 492 |
print("\n1. Basic OCR:")
|
| 493 |
+
print(" uv run --with vllm==0.30.0 dots-ocr.py input-dataset output-dataset")
|
| 494 |
print("\n2. With custom settings:")
|
| 495 |
print(
|
| 496 |
+
" uv run --with vllm==0.30.0 dots-ocr.py docs analyzed-docs --batch-size 20 --max-samples 100"
|
| 497 |
)
|
| 498 |
print("\n3. Layout analysis with structure:")
|
| 499 |
print(
|
| 500 |
+
" uv run --with vllm==0.30.0 dots-ocr.py papers analyzed-structure --prompt-mode layout-all"
|
| 501 |
)
|
| 502 |
print("\n4. Layout detection only (no text):")
|
| 503 |
+
print(" uv run --with vllm==0.30.0 dots-ocr.py docs layout-info --prompt-mode layout-only")
|
| 504 |
print("\n5. Running on HF Jobs (header sets image/flavor/secrets; hf CLI 1.32+):")
|
| 505 |
print(" hf jobs uv run \\")
|
| 506 |
print(
|
|
|
|
| 508 |
)
|
| 509 |
print(" input-dataset output-dataset")
|
| 510 |
print("\n" + "=" * 80)
|
| 511 |
+
print("\nFor full help, run: uv run --with vllm==0.30.0 dots-ocr.py --help")
|
| 512 |
sys.exit(0)
|
| 513 |
|
| 514 |
parser = argparse.ArgumentParser(
|
|
|
|
| 522 |
|
| 523 |
Examples:
|
| 524 |
# Basic text OCR (default)
|
| 525 |
+
uv run --with vllm==0.30.0 dots-ocr.py my-docs analyzed-docs
|
| 526 |
|
| 527 |
# Full layout analysis with structure
|
| 528 |
+
uv run --with vllm==0.30.0 dots-ocr.py papers structured --prompt-mode layout-all
|
| 529 |
|
| 530 |
# Random sampling for testing
|
| 531 |
+
uv run --with vllm==0.30.0 dots-ocr.py large-dataset test --max-samples 50 --shuffle
|
| 532 |
""",
|
| 533 |
)
|
| 534 |
|
glm-ocr.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
| 8 |
# ]
|
| 9 |
#
|
| 10 |
# [tool.hf-jobs]
|
| 11 |
-
#
|
|
|
|
|
|
|
| 12 |
# python = "/usr/bin/python3"
|
| 13 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 14 |
# flavor = "a10g-small"
|
|
@@ -22,10 +24,10 @@ GLM-OCR is a compact 0.9B parameter OCR model achieving 94.62% on OmniDocBench V
|
|
| 22 |
Uses CogViT visual encoder with GLM-0.5B language decoder and Multi-Token Prediction
|
| 23 |
(MTP) loss for fast, accurate document parsing.
|
| 24 |
|
| 25 |
-
NOTE: On Jobs, vLLM, torch and transformers come from the vllm/vllm-openai:v0.
|
| 26 |
image pinned in the [tool.hf-jobs] header (`hf` CLI 1.32+). GLM-OCR needs vLLM
|
| 27 |
>=0.16.0 (PR #33005) and transformers>=5.1.0; the image has both. To run on your
|
| 28 |
-
own GPU: `uv run --with vllm==0.
|
| 29 |
|
| 30 |
Features:
|
| 31 |
- 0.9B parameters (ultra-compact)
|
|
@@ -37,7 +39,7 @@ Features:
|
|
| 37 |
- MIT licensed
|
| 38 |
|
| 39 |
Model: zai-org/GLM-OCR
|
| 40 |
-
vLLM: vllm/vllm-openai:v0.
|
| 41 |
Performance: 94.62% on OmniDocBench V1.5
|
| 42 |
"""
|
| 43 |
|
|
@@ -587,20 +589,20 @@ if __name__ == "__main__":
|
|
| 587 |
print(" table - Table extraction")
|
| 588 |
print("\nExamples:")
|
| 589 |
print("\n1. Basic OCR:")
|
| 590 |
-
print(" uv run --with vllm==0.
|
| 591 |
print("\n2. Formula recognition:")
|
| 592 |
-
print(" uv run --with vllm==0.
|
| 593 |
print("\n3. Table extraction:")
|
| 594 |
-
print(" uv run --with vllm==0.
|
| 595 |
print("\n4. Test with small sample:")
|
| 596 |
-
print(" uv run --with vllm==0.
|
| 597 |
print("\n5. Running on HF Jobs (hardware and HF_TOKEN come from the")
|
| 598 |
print(" script's [tool.hf-jobs] header; --flavor/--timeout override it):")
|
| 599 |
print(
|
| 600 |
" hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \\"
|
| 601 |
)
|
| 602 |
print(" input-dataset output-dataset --batch-size 16")
|
| 603 |
-
print("\nFor full help: uv run --with vllm==0.
|
| 604 |
sys.exit(0)
|
| 605 |
|
| 606 |
parser = argparse.ArgumentParser(
|
|
@@ -613,9 +615,9 @@ Task modes:
|
|
| 613 |
table Table extraction
|
| 614 |
|
| 615 |
Examples:
|
| 616 |
-
uv run --with vllm==0.
|
| 617 |
-
uv run --with vllm==0.
|
| 618 |
-
uv run --with vllm==0.
|
| 619 |
""",
|
| 620 |
)
|
| 621 |
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
| 8 |
# ]
|
| 9 |
#
|
| 10 |
# [tool.hf-jobs]
|
| 11 |
+
# # >=v0.30.0: ships huggingface_hub>=1.31, which datasets>=5.1 imports (httpx). On v0.29.0,
|
| 12 |
+
# # PYTHONPATH puts the image's older hub first and `import datasets` crashes.
|
| 13 |
+
# image = "vllm/vllm-openai:v0.30.0"
|
| 14 |
# python = "/usr/bin/python3"
|
| 15 |
# env = { PYTHONPATH = "/usr/local/lib/python3.12/dist-packages" }
|
| 16 |
# flavor = "a10g-small"
|
|
|
|
| 24 |
Uses CogViT visual encoder with GLM-0.5B language decoder and Multi-Token Prediction
|
| 25 |
(MTP) loss for fast, accurate document parsing.
|
| 26 |
|
| 27 |
+
NOTE: On Jobs, vLLM, torch and transformers come from the vllm/vllm-openai:v0.30.0
|
| 28 |
image pinned in the [tool.hf-jobs] header (`hf` CLI 1.32+). GLM-OCR needs vLLM
|
| 29 |
>=0.16.0 (PR #33005) and transformers>=5.1.0; the image has both. To run on your
|
| 30 |
+
own GPU: `uv run --with vllm==0.30.0 glm-ocr.py ...`.
|
| 31 |
|
| 32 |
Features:
|
| 33 |
- 0.9B parameters (ultra-compact)
|
|
|
|
| 39 |
- MIT licensed
|
| 40 |
|
| 41 |
Model: zai-org/GLM-OCR
|
| 42 |
+
vLLM: vllm/vllm-openai:v0.30.0 image (see the header)
|
| 43 |
Performance: 94.62% on OmniDocBench V1.5
|
| 44 |
"""
|
| 45 |
|
|
|
|
| 589 |
print(" table - Table extraction")
|
| 590 |
print("\nExamples:")
|
| 591 |
print("\n1. Basic OCR:")
|
| 592 |
+
print(" uv run --with vllm==0.30.0 glm-ocr.py input-dataset output-dataset")
|
| 593 |
print("\n2. Formula recognition:")
|
| 594 |
+
print(" uv run --with vllm==0.30.0 glm-ocr.py docs results --task formula")
|
| 595 |
print("\n3. Table extraction:")
|
| 596 |
+
print(" uv run --with vllm==0.30.0 glm-ocr.py docs results --task table")
|
| 597 |
print("\n4. Test with small sample:")
|
| 598 |
+
print(" uv run --with vllm==0.30.0 glm-ocr.py large-dataset test --max-samples 10 --shuffle")
|
| 599 |
print("\n5. Running on HF Jobs (hardware and HF_TOKEN come from the")
|
| 600 |
print(" script's [tool.hf-jobs] header; --flavor/--timeout override it):")
|
| 601 |
print(
|
| 602 |
" hf jobs uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \\"
|
| 603 |
)
|
| 604 |
print(" input-dataset output-dataset --batch-size 16")
|
| 605 |
+
print("\nFor full help: uv run --with vllm==0.30.0 glm-ocr.py --help")
|
| 606 |
sys.exit(0)
|
| 607 |
|
| 608 |
parser = argparse.ArgumentParser(
|
|
|
|
| 615 |
table Table extraction
|
| 616 |
|
| 617 |
Examples:
|
| 618 |
+
uv run --with vllm==0.30.0 glm-ocr.py my-docs analyzed-docs
|
| 619 |
+
uv run --with vllm==0.30.0 glm-ocr.py docs results --task formula
|
| 620 |
+
uv run --with vllm==0.30.0 glm-ocr.py large-dataset test --max-samples 50 --shuffle
|
| 621 |
""",
|
| 622 |
)
|
| 623 |
|
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-
|
| 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`.",
|
|
@@ -127,7 +127,7 @@
|
|
| 127 |
},
|
| 128 |
"support": "core",
|
| 129 |
"jobs": {
|
| 130 |
-
"image": "vllm/vllm-openai:v0.
|
| 131 |
"python": "/usr/bin/python3",
|
| 132 |
"env": {
|
| 133 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
@@ -137,7 +137,7 @@
|
|
| 137 |
"HF_TOKEN"
|
| 138 |
]
|
| 139 |
},
|
| 140 |
-
"image": "vllm/vllm-openai:v0.
|
| 141 |
},
|
| 142 |
"paddleocr-vl.py": {
|
| 143 |
"model_id": "PaddlePaddle/PaddleOCR-VL",
|
|
@@ -506,7 +506,7 @@
|
|
| 506 |
},
|
| 507 |
"support": "core",
|
| 508 |
"jobs": {
|
| 509 |
-
"image": "vllm/vllm-openai:v0.
|
| 510 |
"python": "/usr/bin/python3",
|
| 511 |
"env": {
|
| 512 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
@@ -516,7 +516,7 @@
|
|
| 516 |
"HF_TOKEN"
|
| 517 |
]
|
| 518 |
},
|
| 519 |
-
"image": "vllm/vllm-openai:v0.
|
| 520 |
},
|
| 521 |
"firered-ocr.py": {
|
| 522 |
"model_id": "FireRedTeam/FireRed-OCR",
|
|
@@ -567,7 +567,7 @@
|
|
| 567 |
},
|
| 568 |
"support": "core",
|
| 569 |
"jobs": {
|
| 570 |
-
"image": "vllm/vllm-openai:v0.
|
| 571 |
"python": "/usr/bin/python3",
|
| 572 |
"env": {
|
| 573 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
@@ -577,7 +577,7 @@
|
|
| 577 |
"HF_TOKEN"
|
| 578 |
]
|
| 579 |
},
|
| 580 |
-
"image": "vllm/vllm-openai:v0.
|
| 581 |
},
|
| 582 |
"nanonets-ocr2.py": {
|
| 583 |
"model_id": "nanonets/Nanonets-OCR2-3B",
|
|
|
|
| 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-03",
|
| 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`.",
|
|
|
|
| 127 |
},
|
| 128 |
"support": "core",
|
| 129 |
"jobs": {
|
| 130 |
+
"image": "vllm/vllm-openai:v0.30.0",
|
| 131 |
"python": "/usr/bin/python3",
|
| 132 |
"env": {
|
| 133 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
|
|
| 137 |
"HF_TOKEN"
|
| 138 |
]
|
| 139 |
},
|
| 140 |
+
"image": "vllm/vllm-openai:v0.30.0"
|
| 141 |
},
|
| 142 |
"paddleocr-vl.py": {
|
| 143 |
"model_id": "PaddlePaddle/PaddleOCR-VL",
|
|
|
|
| 506 |
},
|
| 507 |
"support": "core",
|
| 508 |
"jobs": {
|
| 509 |
+
"image": "vllm/vllm-openai:v0.30.0",
|
| 510 |
"python": "/usr/bin/python3",
|
| 511 |
"env": {
|
| 512 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
|
|
| 516 |
"HF_TOKEN"
|
| 517 |
]
|
| 518 |
},
|
| 519 |
+
"image": "vllm/vllm-openai:v0.30.0"
|
| 520 |
},
|
| 521 |
"firered-ocr.py": {
|
| 522 |
"model_id": "FireRedTeam/FireRed-OCR",
|
|
|
|
| 567 |
},
|
| 568 |
"support": "core",
|
| 569 |
"jobs": {
|
| 570 |
+
"image": "vllm/vllm-openai:v0.30.0",
|
| 571 |
"python": "/usr/bin/python3",
|
| 572 |
"env": {
|
| 573 |
"PYTHONPATH": "/usr/local/lib/python3.12/dist-packages"
|
|
|
|
| 577 |
"HF_TOKEN"
|
| 578 |
]
|
| 579 |
},
|
| 580 |
+
"image": "vllm/vllm-openai:v0.30.0"
|
| 581 |
},
|
| 582 |
"nanonets-ocr2.py": {
|
| 583 |
"model_id": "nanonets/Nanonets-OCR2-3B",
|