Sync from GitHub via hub-sync
Browse files- deepseek-ocr-vllm.py +1 -1
- deepseek-ocr2-vllm.py +1 -1
- hunyuan-ocr-1.5.py +1 -1
- lfm2-extract.py +1 -1
- lighton-ocr2.py +5 -4
- nuextract3.py +1 -1
- ocr-vllm-judge.py +1 -1
- olmocr2-vllm.py +1 -1
- ovis-ocr2.py +1 -1
- paddleocr-vl-1.6.py +1 -1
- qianfan-ocr.py +1 -1
- surya-ocr-bucket.py +4 -4
- surya-ocr.py +5 -3
- unlimited-ocr-vllm.py +11 -1
deepseek-ocr-vllm.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
deepseek-ocr2-vllm.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
hunyuan-ocr-1.5.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
lfm2-extract.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "transformers",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "transformers",
|
| 7 |
# "tqdm",
|
lighton-ocr2.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
@@ -63,7 +63,7 @@ from datetime import datetime
|
|
| 63 |
|
| 64 |
import torch
|
| 65 |
from datasets import load_dataset
|
| 66 |
-
from huggingface_hub import DatasetCard
|
| 67 |
from PIL import Image
|
| 68 |
from toolz import partition_all
|
| 69 |
from tqdm.auto import tqdm
|
|
@@ -335,10 +335,11 @@ def main(
|
|
| 335 |
# Track processing start time
|
| 336 |
start_time = datetime.now()
|
| 337 |
|
| 338 |
-
#
|
|
|
|
| 339 |
HF_TOKEN = hf_token or os.environ.get("HF_TOKEN")
|
| 340 |
if HF_TOKEN:
|
| 341 |
-
|
| 342 |
|
| 343 |
logger.info(f"Using model: {MODEL}")
|
| 344 |
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 63 |
|
| 64 |
import torch
|
| 65 |
from datasets import load_dataset
|
| 66 |
+
from huggingface_hub import DatasetCard
|
| 67 |
from PIL import Image
|
| 68 |
from toolz import partition_all
|
| 69 |
from tqdm.auto import tqdm
|
|
|
|
| 335 |
# Track processing start time
|
| 336 |
start_time = datetime.now()
|
| 337 |
|
| 338 |
+
# Set the env var instead of login(): the old huggingface_hub in this image
|
| 339 |
+
# raises KeyError on a Jobs token in login(). Hub calls read HF_TOKEN.
|
| 340 |
HF_TOKEN = hf_token or os.environ.get("HF_TOKEN")
|
| 341 |
if HF_TOKEN:
|
| 342 |
+
os.environ["HF_TOKEN"] = HF_TOKEN
|
| 343 |
|
| 344 |
logger.info(f"Using model: {MODEL}")
|
| 345 |
|
nuextract3.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=3.1.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=3.1.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
ocr-vllm-judge.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
# /// script
|
| 3 |
# requires-python = ">=3.11"
|
| 4 |
# dependencies = [
|
| 5 |
-
# "datasets>=4.0.0",
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "rich",
|
|
|
|
| 2 |
# /// script
|
| 3 |
# requires-python = ">=3.11"
|
| 4 |
# dependencies = [
|
| 5 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "rich",
|
olmocr2-vllm.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
ovis-ocr2.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "toolz",
|
paddleocr-vl-1.6.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
qianfan-ocr.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
surya-ocr-bucket.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "surya-ocr==0.20.0",
|
| 5 |
-
# "datasets>=3.1.0",
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "imagecodecs",
|
|
@@ -1061,10 +1061,10 @@ def main(args: argparse.Namespace) -> None:
|
|
| 1061 |
start_time = datetime.now(timezone.utc)
|
| 1062 |
|
| 1063 |
hf_token = args.hf_token or os.environ.get("HF_TOKEN")
|
|
|
|
|
|
|
| 1064 |
if hf_token:
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
login(token=hf_token)
|
| 1068 |
|
| 1069 |
exts = {e.strip().lower() for e in args.extensions.split(",") if e.strip()}
|
| 1070 |
io_mode = resolve_io_mode(args.io_mode, args.input_source)
|
|
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "surya-ocr==0.20.0",
|
| 5 |
+
# "datasets>=3.1.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "imagecodecs",
|
|
|
|
| 1061 |
start_time = datetime.now(timezone.utc)
|
| 1062 |
|
| 1063 |
hf_token = args.hf_token or os.environ.get("HF_TOKEN")
|
| 1064 |
+
# Set the env var instead of login(): the old huggingface_hub in this image
|
| 1065 |
+
# raises KeyError on a Jobs token in login(). Hub calls read HF_TOKEN.
|
| 1066 |
if hf_token:
|
| 1067 |
+
os.environ["HF_TOKEN"] = hf_token
|
|
|
|
|
|
|
| 1068 |
|
| 1069 |
exts = {e.strip().lower() for e in args.extensions.split(",") if e.strip()}
|
| 1070 |
io_mode = resolve_io_mode(args.io_mode, args.input_source)
|
surya-ocr.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "surya-ocr",
|
| 5 |
-
# "datasets>=3.1.0",
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "toolz",
|
|
@@ -83,7 +83,7 @@ from typing import Any, Dict, List, Optional, Tuple
|
|
| 83 |
from urllib.request import urlopen
|
| 84 |
|
| 85 |
from datasets import load_dataset
|
| 86 |
-
from huggingface_hub import DatasetCard
|
| 87 |
from PIL import Image
|
| 88 |
from toolz import partition_all
|
| 89 |
from tqdm import tqdm
|
|
@@ -529,9 +529,11 @@ def main(
|
|
| 529 |
check_vllm_available()
|
| 530 |
start_time = datetime.now(timezone.utc)
|
| 531 |
|
|
|
|
|
|
|
| 532 |
HF_TOKEN = hf_token or os.environ.get("HF_TOKEN")
|
| 533 |
if HF_TOKEN:
|
| 534 |
-
|
| 535 |
|
| 536 |
# Import Surya only after env is set.
|
| 537 |
from surya.input.load import load_pdf
|
|
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "surya-ocr",
|
| 5 |
+
# "datasets>=3.1.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 6 |
# "huggingface-hub",
|
| 7 |
# "pillow",
|
| 8 |
# "toolz",
|
|
|
|
| 83 |
from urllib.request import urlopen
|
| 84 |
|
| 85 |
from datasets import load_dataset
|
| 86 |
+
from huggingface_hub import DatasetCard
|
| 87 |
from PIL import Image
|
| 88 |
from toolz import partition_all
|
| 89 |
from tqdm import tqdm
|
|
|
|
| 529 |
check_vllm_available()
|
| 530 |
start_time = datetime.now(timezone.utc)
|
| 531 |
|
| 532 |
+
# Set the env var instead of login(): the old huggingface_hub in this image
|
| 533 |
+
# raises KeyError on a Jobs token in login(). Hub calls read HF_TOKEN.
|
| 534 |
HF_TOKEN = hf_token or os.environ.get("HF_TOKEN")
|
| 535 |
if HF_TOKEN:
|
| 536 |
+
os.environ["HF_TOKEN"] = HF_TOKEN
|
| 537 |
|
| 538 |
# Import Surya only after env is set.
|
| 539 |
from surya.input.load import load_pdf
|
unlimited-ocr-vllm.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "datasets>=4.0.0",
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
@@ -80,6 +80,10 @@ logging.basicConfig(level=logging.INFO)
|
|
| 80 |
logger = logging.getLogger(__name__)
|
| 81 |
|
| 82 |
MODEL = "baidu/Unlimited-OCR"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
# Prompt and no-repeat-ngram knobs straight from the model card / vLLM recipe (single image).
|
| 85 |
PROMPT = "<image>document parsing."
|
|
@@ -271,8 +275,14 @@ def main(
|
|
| 271 |
logger.info(f"Initializing vLLM with model: {model}")
|
| 272 |
logger.info("This may take a few minutes on first run...")
|
| 273 |
|
|
|
|
|
|
|
|
|
|
| 274 |
llm = LLM(
|
| 275 |
model=model,
|
|
|
|
|
|
|
|
|
|
| 276 |
trust_remote_code=True,
|
| 277 |
max_model_len=max_model_len,
|
| 278 |
gpu_memory_utilization=gpu_memory_utilization,
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "datasets>=4.0.0,<5.1", # 5.1 needs huggingface_hub>=1.31; the image ships an older 1.x on PYTHONPATH, which wins
|
| 5 |
# "huggingface-hub",
|
| 6 |
# "pillow",
|
| 7 |
# "tqdm",
|
|
|
|
| 80 |
logger = logging.getLogger(__name__)
|
| 81 |
|
| 82 |
MODEL = "baidu/Unlimited-OCR"
|
| 83 |
+
# Last revision tested with this recipe and image. The 2026-10-14 upstream update
|
| 84 |
+
# ("compatibility with transformers") makes the remote code import addict and
|
| 85 |
+
# matplotlib at config load, which this image lacks. Re-test before moving it.
|
| 86 |
+
MODEL_REVISION = "07dea832e22aefee32ad281d4b80551282e1c168"
|
| 87 |
|
| 88 |
# Prompt and no-repeat-ngram knobs straight from the model card / vLLM recipe (single image).
|
| 89 |
PROMPT = "<image>document parsing."
|
|
|
|
| 275 |
logger.info(f"Initializing vLLM with model: {model}")
|
| 276 |
logger.info("This may take a few minutes on first run...")
|
| 277 |
|
| 278 |
+
# The pin applies to the default model only; another --model loads its main branch.
|
| 279 |
+
revision = MODEL_REVISION if model == MODEL else None
|
| 280 |
+
logger.info(f"Model revision: {revision or 'main'}")
|
| 281 |
llm = LLM(
|
| 282 |
model=model,
|
| 283 |
+
revision=revision,
|
| 284 |
+
code_revision=revision,
|
| 285 |
+
tokenizer_revision=revision,
|
| 286 |
trust_remote_code=True,
|
| 287 |
max_model_len=max_model_len,
|
| 288 |
gpu_memory_utilization=gpu_memory_utilization,
|