Commit 
							
							Β·
						
						2d80026
	
1
								Parent(s):
							
							3073a00
								
Document DeepSeek-OCR in README with real examples
Browse filesAdded comprehensive documentation for deepseek-ocr-vllm.py:
- Added to Available Scripts section with β NEW badge
- Documented all 5 resolution modes (tiny/small/base/large/gundam)
- Documented all 5 prompt modes (document/image/free/figure/describe)
- Added 3 real-world HF Jobs examples:
  * National Library of Scotland handbooks (a100-large, large mode)
  * Fast testing with tiny mode (l4x1)
  * Figure parsing from scientific papers
- Added script-specific options section
- Emphasized UV_TORCH_BACKEND=auto requirement for HF Jobs
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
    	
        README.md
    CHANGED
    
    | @@ -31,6 +31,34 @@ That's it! The script will: | |
| 31 |  | 
| 32 | 
             
            ## π Available Scripts
         | 
| 33 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 34 | 
             
            ### RolmOCR (`rolm-ocr.py`)
         | 
| 35 |  | 
| 36 | 
             
            Fast general-purpose OCR using [reducto/RolmOCR](https://huggingface.co/reducto/RolmOCR) based on Qwen2.5-VL-7B:
         | 
| @@ -141,7 +169,35 @@ Every OCR run now generates comprehensive dataset documentation including: | |
| 141 | 
             
            No GPU? No problem! Run on HF infrastructure:
         | 
| 142 |  | 
| 143 | 
             
            ```bash
         | 
| 144 | 
            -
            #  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 145 | 
             
            hf jobs uv run --flavor l4x1 \
         | 
| 146 | 
             
                --secrets HF_TOKEN \
         | 
| 147 | 
             
                https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \
         | 
| @@ -255,6 +311,13 @@ Any HuggingFace dataset containing images - documents, forms, receipts, books, h | |
| 255 |  | 
| 256 | 
             
            ### Script-Specific Options
         | 
| 257 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 258 | 
             
            **RolmOCR**:
         | 
| 259 | 
             
            - Output column is auto-generated from model name (e.g., `rolmocr_text`)
         | 
| 260 | 
             
            - Use `--output-column` to override the default name
         | 
|  | |
| 31 |  | 
| 32 | 
             
            ## π Available Scripts
         | 
| 33 |  | 
| 34 | 
            +
            ### DeepSeek-OCR (`deepseek-ocr-vllm.py`) β NEW
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            Advanced document OCR using [deepseek-ai/DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR) with visual-text compression:
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            - π **LaTeX equations** - Mathematical formulas in LaTeX format
         | 
| 39 | 
            +
            - π **Tables** - Extracted as HTML/markdown
         | 
| 40 | 
            +
            - π **Document structure** - Headers, lists, formatting preserved
         | 
| 41 | 
            +
            - πΌοΈ **Image grounding** - Spatial layout with bounding boxes
         | 
| 42 | 
            +
            - π **Complex layouts** - Multi-column and hierarchical structures
         | 
| 43 | 
            +
            - π **Multilingual** - Multiple language support
         | 
| 44 | 
            +
            - ποΈ **Resolution modes** - 5 presets for speed/quality trade-offs
         | 
| 45 | 
            +
            - π¬ **Prompt modes** - 5 presets for different OCR tasks
         | 
| 46 | 
            +
            - β‘ **Fast batch processing** - vLLM acceleration
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            **Resolution Modes:**
         | 
| 49 | 
            +
            - `tiny` (512Γ512): Fast, 64 vision tokens
         | 
| 50 | 
            +
            - `small` (640Γ640): Balanced, 100 vision tokens
         | 
| 51 | 
            +
            - `base` (1024Γ1024): High quality, 256 vision tokens
         | 
| 52 | 
            +
            - `large` (1280Γ1280): Maximum quality, 400 vision tokens
         | 
| 53 | 
            +
            - `gundam` (dynamic): Adaptive multi-tile (default)
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            **Prompt Modes:**
         | 
| 56 | 
            +
            - `document`: Convert to markdown with grounding (default)
         | 
| 57 | 
            +
            - `image`: OCR any image with grounding
         | 
| 58 | 
            +
            - `free`: Fast OCR without layout
         | 
| 59 | 
            +
            - `figure`: Parse figures from documents
         | 
| 60 | 
            +
            - `describe`: Detailed image descriptions
         | 
| 61 | 
            +
             | 
| 62 | 
             
            ### RolmOCR (`rolm-ocr.py`)
         | 
| 63 |  | 
| 64 | 
             
            Fast general-purpose OCR using [reducto/RolmOCR](https://huggingface.co/reducto/RolmOCR) based on Qwen2.5-VL-7B:
         | 
|  | |
| 169 | 
             
            No GPU? No problem! Run on HF infrastructure:
         | 
| 170 |  | 
| 171 | 
             
            ```bash
         | 
| 172 | 
            +
            # DeepSeek-OCR - Real-world example (National Library of Scotland handbooks)
         | 
| 173 | 
            +
            hf jobs uv run --flavor a100-large \
         | 
| 174 | 
            +
                -s HF_TOKEN \
         | 
| 175 | 
            +
                -e UV_TORCH_BACKEND=auto \
         | 
| 176 | 
            +
                https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \
         | 
| 177 | 
            +
                NationalLibraryOfScotland/Britain-and-UK-Handbooks-Dataset \
         | 
| 178 | 
            +
                davanstrien/handbooks-deep-ocr \
         | 
| 179 | 
            +
                --max-samples 100 \
         | 
| 180 | 
            +
                --shuffle \
         | 
| 181 | 
            +
                --resolution-mode large
         | 
| 182 | 
            +
             | 
| 183 | 
            +
            # DeepSeek-OCR - Fast testing with tiny mode
         | 
| 184 | 
            +
            hf jobs uv run --flavor l4x1 \
         | 
| 185 | 
            +
                -s HF_TOKEN \
         | 
| 186 | 
            +
                -e UV_TORCH_BACKEND=auto \
         | 
| 187 | 
            +
                https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \
         | 
| 188 | 
            +
                your-input-dataset your-output-dataset \
         | 
| 189 | 
            +
                --max-samples 10 \
         | 
| 190 | 
            +
                --resolution-mode tiny
         | 
| 191 | 
            +
             | 
| 192 | 
            +
            # DeepSeek-OCR - Parse figures from scientific papers
         | 
| 193 | 
            +
            hf jobs uv run --flavor a100-large \
         | 
| 194 | 
            +
                -s HF_TOKEN \
         | 
| 195 | 
            +
                -e UV_TORCH_BACKEND=auto \
         | 
| 196 | 
            +
                https://huggingface.co/datasets/uv-scripts/ocr/raw/main/deepseek-ocr-vllm.py \
         | 
| 197 | 
            +
                scientific-papers figures-extracted \
         | 
| 198 | 
            +
                --prompt-mode figure
         | 
| 199 | 
            +
             | 
| 200 | 
            +
            # Basic OCR job with Nanonets
         | 
| 201 | 
             
            hf jobs uv run --flavor l4x1 \
         | 
| 202 | 
             
                --secrets HF_TOKEN \
         | 
| 203 | 
             
                https://huggingface.co/datasets/uv-scripts/ocr/raw/main/nanonets-ocr.py \
         | 
|  | |
| 311 |  | 
| 312 | 
             
            ### Script-Specific Options
         | 
| 313 |  | 
| 314 | 
            +
            **DeepSeek-OCR**:
         | 
| 315 | 
            +
            - `--resolution-mode`: Quality level - `tiny`, `small`, `base`, `large`, or `gundam` (default)
         | 
| 316 | 
            +
            - `--prompt-mode`: Task type - `document` (default), `image`, `free`, `figure`, or `describe`
         | 
| 317 | 
            +
            - `--prompt`: Custom OCR prompt (overrides prompt-mode)
         | 
| 318 | 
            +
            - `--base-size`, `--image-size`, `--crop-mode`: Override resolution mode manually
         | 
| 319 | 
            +
            - β οΈ **Important for HF Jobs**: Add `-e UV_TORCH_BACKEND=auto` for proper PyTorch installation
         | 
| 320 | 
            +
             | 
| 321 | 
             
            **RolmOCR**:
         | 
| 322 | 
             
            - Output column is auto-generated from model name (e.g., `rolmocr_text`)
         | 
| 323 | 
             
            - Use `--output-column` to override the default name
         | 

