Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
viewer: false
|
| 3 |
-
tags: [uv-script, ocr, vision-language-model, document-processing]
|
| 4 |
---
|
| 5 |
|
| 6 |
# OCR UV Scripts
|
|
@@ -70,6 +70,50 @@ hf jobs uv run --flavor l4x1 \
|
|
| 70 |
--batch-size 32
|
| 71 |
```
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
### LightOnOCR (`lighton-ocr.py`) ⚡ Good one to test first since it's small and fast!
|
| 74 |
|
| 75 |
Fast and compact OCR using [lightonai/LightOnOCR-1B-1025](https://huggingface.co/lightonai/LightOnOCR-1B-1025):
|
|
@@ -319,6 +363,14 @@ hf jobs uv run --flavor l4x1 \
|
|
| 319 |
--task-mode formula \
|
| 320 |
--batch-size 32
|
| 321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
# DeepSeek-OCR - Real-world example (National Library of Scotland handbooks)
|
| 323 |
hf jobs uv run --flavor a100-large \
|
| 324 |
-s HF_TOKEN \
|
|
@@ -482,6 +534,13 @@ Any HuggingFace dataset containing images - documents, forms, receipts, books, h
|
|
| 482 |
- `--output-column`: Override default column name (default: `paddleocr_[task_mode]`)
|
| 483 |
- Ultra-compact 0.9B model - fastest initialization!
|
| 484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
**DeepSeek-OCR**:
|
| 486 |
|
| 487 |
- `--resolution-mode`: Quality level - `tiny`, `small`, `base`, `large`, or `gundam` (default)
|
|
|
|
| 1 |
---
|
| 2 |
viewer: false
|
| 3 |
+
tags: [uv-script, ocr, vision-language-model, document-processing, hf-jobs]
|
| 4 |
---
|
| 5 |
|
| 6 |
# OCR UV Scripts
|
|
|
|
| 70 |
--batch-size 32
|
| 71 |
```
|
| 72 |
|
| 73 |
+
### GLM-OCR (`glm-ocr.py`) 🏆 SOTA on OmniDocBench V1.5!
|
| 74 |
+
|
| 75 |
+
Compact high-performance OCR using [zai-org/GLM-OCR](https://huggingface.co/zai-org/GLM-OCR) with 0.9B parameters:
|
| 76 |
+
|
| 77 |
+
- 🏆 **94.62% on OmniDocBench V1.5** - #1 overall ranking
|
| 78 |
+
- 🧠 **Multi-Token Prediction** - MTP loss + stable full-task RL for quality
|
| 79 |
+
- 📝 **Text recognition** - Clean markdown output
|
| 80 |
+
- 📐 **Formula recognition** - LaTeX mathematical notation
|
| 81 |
+
- 📊 **Table recognition** - Structured table extraction
|
| 82 |
+
- 🌍 **Multilingual** - zh, en, fr, es, ru, de, ja, ko
|
| 83 |
+
- ⚡ **Compact** - Only 0.9B parameters, MIT licensed
|
| 84 |
+
- 🔧 **CogViT + GLM** - Visual encoder with efficient token downsampling
|
| 85 |
+
|
| 86 |
+
**Task Modes:**
|
| 87 |
+
|
| 88 |
+
- `ocr`: Text recognition (default)
|
| 89 |
+
- `formula`: LaTeX formula recognition
|
| 90 |
+
- `table`: Table extraction
|
| 91 |
+
|
| 92 |
+
**Quick start:**
|
| 93 |
+
|
| 94 |
+
```bash
|
| 95 |
+
# Basic OCR
|
| 96 |
+
hf jobs uv run --flavor a100-large \
|
| 97 |
+
-s HF_TOKEN \
|
| 98 |
+
https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \
|
| 99 |
+
your-input-dataset your-output-dataset \
|
| 100 |
+
--max-samples 100
|
| 101 |
+
|
| 102 |
+
# Formula recognition
|
| 103 |
+
hf jobs uv run --flavor a100-large \
|
| 104 |
+
-s HF_TOKEN \
|
| 105 |
+
https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \
|
| 106 |
+
scientific-papers formulas-extracted \
|
| 107 |
+
--task formula
|
| 108 |
+
|
| 109 |
+
# Table extraction
|
| 110 |
+
hf jobs uv run --flavor a100-large \
|
| 111 |
+
-s HF_TOKEN \
|
| 112 |
+
https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \
|
| 113 |
+
documents tables-extracted \
|
| 114 |
+
--task table
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
### LightOnOCR (`lighton-ocr.py`) ⚡ Good one to test first since it's small and fast!
|
| 118 |
|
| 119 |
Fast and compact OCR using [lightonai/LightOnOCR-1B-1025](https://huggingface.co/lightonai/LightOnOCR-1B-1025):
|
|
|
|
| 363 |
--task-mode formula \
|
| 364 |
--batch-size 32
|
| 365 |
|
| 366 |
+
# GLM-OCR - SOTA 0.9B model (94.62% OmniDocBench)
|
| 367 |
+
hf jobs uv run --flavor a100-large \
|
| 368 |
+
-s HF_TOKEN \
|
| 369 |
+
https://huggingface.co/datasets/uv-scripts/ocr/raw/main/glm-ocr.py \
|
| 370 |
+
your-input-dataset your-output-dataset \
|
| 371 |
+
--batch-size 16 \
|
| 372 |
+
--max-samples 100
|
| 373 |
+
|
| 374 |
# DeepSeek-OCR - Real-world example (National Library of Scotland handbooks)
|
| 375 |
hf jobs uv run --flavor a100-large \
|
| 376 |
-s HF_TOKEN \
|
|
|
|
| 534 |
- `--output-column`: Override default column name (default: `paddleocr_[task_mode]`)
|
| 535 |
- Ultra-compact 0.9B model - fastest initialization!
|
| 536 |
|
| 537 |
+
**GLM-OCR**:
|
| 538 |
+
|
| 539 |
+
- `--task`: Task type - `ocr` (default), `formula`, or `table`
|
| 540 |
+
- `--repetition-penalty`: Repetition penalty (default: 1.1, from official SDK)
|
| 541 |
+
- Near-greedy sampling by default (temperature=0.01, top_p=0.00001) matching official SDK
|
| 542 |
+
- Requires vLLM nightly + transformers from git (handled automatically)
|
| 543 |
+
|
| 544 |
**DeepSeek-OCR**:
|
| 545 |
|
| 546 |
- `--resolution-mode`: Quality level - `tiny`, `small`, `base`, `large`, or `gundam` (default)
|