Commit ·
90ace90
1
Parent(s): 2204718
Add DoTS.ocr to documentation with official --secrets syntax
Browse files15 unmodified lines16171819202149 unmodified lines71727374757641 unmodified lines1181191201211221231241251261271281291301311323 unmodified lines1361371381391401411421431442 unmodified lines14714814915015115215351 unmodified lines20520620720820921021121221321421521621721815 unmodified lines```bash# Quick test with 10 sampleshf jobs uv run --flavor l4x1 \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`## 🆕 New Features41 unmodified lines```bash# Basic OCR jobhf jobs uv run --flavor l4x1 \https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \your-input-dataset your-output-dataset# 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())") \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())") \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())") \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 uses 16384/8192### RolmOCR Specific- 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)More OCR VLM Scripts coming soon! Stay tuned for updates!15 unmodified lines1617181920212249 unmodified lines727374757677787980818283848586878841 unmodified lines1301311321331341351361371381391401411421431441451461471481491501511521533 unmodified lines1571581591601611621631642 unmodified lines16716816917017117217351 unmodified lines22522622722822923023123223323423523623723823924024124215 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 Features41 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 \--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 \--flavor l4x4 \--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 \--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 and DoTS use batch size 16**RolmOCR uses 16384/8192### Script-Specific Options**RolmOCR**:- Output column is auto-generated from model name (e.g., `rolmocr_text`)- Use `--output-column` to override the default name**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`)💡 **Performance tip**: Increase batch size for faster processing (e.g., `--batch-size 256` on A100)
README.md+33-9