Commit ·
90ace90
1
Parent(s): 2204718
Add DoTS.ocr to documentation with official --secrets syntax
Browse files15 unmodified lines1617181920212249 unmodified lines727374757677787980818283848586878841 unmodified lines1301311321331341351361371381391401411421431441451461471481491281291501511521533 unmodified lines1571581591391601411611621631642 unmodified lines16716816915017017117217351 unmodified lines22522622720822822923021123123223323423523621623723823924024121824215 unmodified lines```bash# Quick test with 10 sampleshf jobs uv run --flavor l4x1 \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \ your-input-dataset your-output-dataset \ --max-samples 1049 unmodified lines- 🔍 **Multi-column Layouts** - Handles complex document structures- ✨ **Thinking Traces** - Optional inclusion of reasoning process with `--include-thinking`
### DoTS.ocr (`dots-ocr.py`)
Compact multilingual OCR using [rednote-hilab/dots.ocr](https://huggingface.co/rednote-hilab/dots.ocr) with only 1.7B parameters:
- 🌍 **100+ Languages** - Extensive multilingual support- 📝 **Simple OCR** - Clean text extraction (default mode)- 📊 **Layout Analysis** - Optional structured output with bboxes and categories- 📐 **Formula recognition** - LaTeX format support- 🎯 **Compact** - Only 1.7B parameters, efficient on smaller GPUs- 🔀 **Flexible prompts** - Switch between OCR, layout-all, and layout-only modes
## 🆕 New Features
41 unmodified lines```bash# Basic OCR jobhf jobs uv run --flavor l4x1 \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \ your-input-dataset your-output-dataset
# DoTS.ocr - Multilingual OCR with compact 1.7B modelhf jobs uv run --flavor a100-large \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/dots-ocr.py \ davanstrien/ufo-ColPali \ your-username/ufo-ocr \ --batch-size 256 \ --max-samples 1000 \ --shuffle
# Real example with UFO dataset 🛸hf jobs uv run \ --flavor a10g-large \ --image vllm/vllm-openai:latest \ -s HF_TOKEN=$(python3 -c "from huggingface_hub import get_token; print(get_token())") \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \ davanstrien/ufo-ColPali \ your-username/ufo-ocr \3 unmodified lines
# NuMarkdown with reasoning traces for complex documentshf jobs uv run \ --image vllm/vllm-openai:latest \ --flavor l4x4 \ -s HF_TOKEN=$(python3 -c "from huggingface_hub import get_token; print(get_token())") \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/numarkdown-ocr.py \ your-input-dataset your-output-dataset \ --max-samples 50 \2 unmodified lines
# Private dataset with custom settingshf jobs uv run --flavor l40sx1 \ -s HF_TOKEN=$(python3 -c "from huggingface_hub import get_token; print(get_token())") \ --secrets HF_TOKEN \ https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \ private-input private-output \ --private \51 unmodified lines| `--shuffle` | False | Shuffle dataset before processing || `--seed` | `42` | Random seed for shuffling |
*RolmOCR uses batch size 16*RolmOCR and DoTS use batch size 16**RolmOCR uses 16384/8192
### RolmOCR Specific### Script-Specific Options
**RolmOCR**:- Output column is auto-generated from model name (e.g., `rolmocr_text`)- Use `--output-column` to override the default name
💡 **Performance tip**: Increase batch size for faster processing (e.g., `--batch-size 128` for A10G GPUs)**DoTS.ocr**:- `--prompt-mode`: Choose `ocr` (default), `layout-all`, or `layout-only`- `--custom-prompt`: Override with custom prompt text- `--output-column`: Output column name (default: `markdown`)
More OCR VLM Scripts coming soon! Stay tuned for updates!💡 **Performance tip**: Increase batch size for faster processing (e.g., `--batch-size 256` on A100)README.md+33-9