- Revert to using nightly wheels (required for LightOnOCR-2 support)
- Add known issue note about image processor loading failure
- Update CLAUDE.md with detailed status and test commands
- vLLM nightly broke between v0.15.0rc2.dev73 and dev81
The script was working before the nightly update. Error:
"OSError: Can't load image processor for lightonai/LightOnOCR-2-1B"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix vLLM version constraint - v0.15.0 not on PyPI yet
The vLLM nightly had a regression causing image processor loading
to fail. Using stable release for reliability.
Removed:
- triton-kernels git dependency (not needed for stable)
- nightly wheel index
- prerelease allow setting
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The enable_prefix_caching=False parameter causes vLLM to fail with:
'OSError: Can't load image processor for lightonai/LightOnOCR-2-1B'
Keeping only the max_tokens change (6144 -> 4096) to fix repetition.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The mm_processor_kwargs parameter caused vLLM to fail with OSError
when loading the image processor. Keeping other fixes:
- max_tokens=4096 (recommended by model card)
- enable_prefix_caching=False (recommended by model card)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix LightOnOCR-2 repetition issues and configuration
- Change max_tokens default from 6144 to 4096 (as recommended by model card)
- Add enable_prefix_caching=False (recommended by model card)
- Add mm_processor_kwargs with cache_gb=0 to disable multimodal processor caching
- Replace deprecated hf_transfer extra with hf-xet package
These changes align with the official vLLM serve recommendations:
vllm serve lightonai/LightOnOCR-2-1B \
--limit-mm-per-prompt '{"image": 1}' \
--mm-processor-cache-gb 0 \
--no-enable-prefix-caching
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pin pyarrow>=17.0.0,<18.0.0 to avoid PyExtensionType issue.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add LightOnOCR-2-1B support (next-gen OCR with RLVR)
davanstrien+1: Claude Sonnet 4.5 (1M context)HF Staff
0b3448a
Key improvements over v1:
- 7.5× faster: 42.8 vs 5.71 pages/sec on H100
- +7.1% accuracy: 83.2% vs 76.1% on OlmOCR-Bench
- RLVR training eliminates repetition loops
- Simpler: single model (no vocabulary variants)
Critical fix: Removed empty text prefix from message format
to match official LightOnOCR-2 implementation.
Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Fix: Remove pyarrow, use huggingface-hub without extras, pin datasets>=4.0.0
Update message format to match LightOn's official demo implementation:
- Add empty text element before image in content array
- Order: text first, then image (matching their Gradio demo)
This ensures we're using the exact same message structure as their
production demo, which should improve reliability and quality.
Reference: Official demo at https://huggingface.co/spaces/lightonai/LightOnOCR
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Based on feedback from LightOn authors (@staghado), update default
image resolution from 1288px to 1540px to match training settings.
Changes:
- Default target_size: 1288px → 1540px
- Updated docstrings: trained at 200 DPI (not 300 DPI)
- Updated help text to note this matches training
The model was trained with max resolution of 1540px and 200 DPI,
so using these settings should provide optimal quality.
Reference: https://x.com/staghado/status/1849518069623726119
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Add LightOnOCR as first script in README with recommendation to test
first since it's small and fast.
Features highlighted:
- Fastest OCR option (5.71 pages/sec on H100, 6.25 images/sec on A100)
- Compact 1B parameters for quick downloads
- 3 vocabulary sizes (151k/32k/16k) with European language optimization
- LaTeX formulas and table extraction
- Production-ready with 76.1% benchmark score
Includes quick start examples:
- L4 test run with 100 samples
- A100 production run with batch_size=4096
Positioning LightOnOCR as the recommended starting point for users
new to the OCR scripts due to fast initialization and excellent
speed/quality balance.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Add explicit triton-kernels dependency from git to resolve vLLM
nightly build dependency resolution issue.
Error was: "Package `triton-kernels` was included as a URL dependency.
URL dependencies must be expressed as direct requirements"
Solution: Add triton-kernels as direct git dependency pointing to
v3.5.0 subdirectory as required by vLLM nightly.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Update LightOnOCR script to use vLLM nightly wheels
LightOnOCR support requires vLLM nightly build from main branch.
Added configuration to use nightly wheels, similar to DeepSeek-OCR script.
Changes:
- Use vLLM nightly wheels from https://wheels.vllm.ai/nightly
- Add prerelease = "allow" for UV
- Update docstring to note nightly requirement
- Remove version constraint from vLLM dependency
This matches the pattern used in deepseek-ocr-vllm.py which also
requires cutting-edge vLLM features.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Adds lighton-ocr.py - a UV script for processing documents with
LightOnOCR, a compact 1B OCR model optimized for production speed.
Features:
- Fast: 5.71 pages/sec on H100 GPU
- Compact: Only 1B parameters
- 3 vocabulary variants (151k/32k/16k tokens)
- European language optimization (12% faster with 32k/16k)
- LaTeX formula and table extraction
- Markdown output format
- Image preprocessing (1288px target size)
Based on dots-ocr.py template with adaptations:
- LightOnOCR-specific sampling params (temp=0.2, top_p=0.9)
- Automatic image resizing to optimal dimensions
- Vocabulary size selection
- Simplified prompt handling (no special modes)
Model: lightonai/LightOnOCR-1B-1025
vLLM: Officially supported in model registry
Blog: https://huggingface.co/blog/lightonai/lightonocr
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
Two critical changes to match official olmOCR implementation:
1. **Temperature 0.1 (was 0.0)**
- Matches olmOCR transformers example
- Their pipeline also starts at 0.1 (not 0.0)
- Temperature 0.0 with sampling can cause quality issues
2. **Image resizing to 1288px on longest edge**
- Official pipeline default: target_longest_image_dim=1288
- Model was trained with images at this resolution
- Ensures consistent token counts and detail level
- Uses LANCZOS resampling for quality
These are the two highest-impact fixes identified by code review comparing
our implementation to official olmOCR pipeline and transformers example.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Change content order from [image, text] to [text, image]
- Matches olmOCR pipeline.py build_page_query implementation
- Order can affect VLM behavior and output quality
This could fix issues with missing YAML front matter and output quality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add repetition penalty, guided decoding, and finish_reason logging
- Changes metadata column from fixed 'olmocr_metadata' to '{output_column}_metadata'
- Allows multiple OCR runs on same dataset with different column names
- Handles existing columns by removing and overwriting with warning
- Enables workflow: process same dataset with different models/settings
Example:
--output-column markdown → markdown_metadata
--output-column olmocr2 → olmocr2_metadata
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Allow users to specify custom output column name
- Default remains "markdown" for consistency
- Matches pattern from dots-ocr.py and rolm-ocr.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Change olmOCR2 temperature from 0.1 to 0.0 to match original implementation
Added 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>
This ensures UV automatically selects the correct PyTorch wheel
based on the available CUDA/GPU environment during installation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Changed from:
[[tool.uv.index]]
name = "vllm-nightly"
url = "https://wheels.vllm.ai"
To:
[[tool.uv.index]]
url = "https://wheels.vllm.ai/nightly"
- Removed unnecessary 'name' field (simpler syntax per UV docs)
- Fixed URL to use /nightly path for nightly builds
- Should now properly install pre-built wheels instead of building from source
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
PR #27247 is now merged to main, so we can use the official nightly wheels
instead of the fork branch.
Changes:
- Replace git+https://github.com/Isotr0py/vllm.git@deepseek-ocr with vllm
- Add [[tool.uv.index]] for https://wheels.vllm.ai
- Keep prerelease = "allow" for nightly builds
- Update docstrings to reflect PR merged status
- Update error messages (remove PR reference)
This should provide faster installation since we're using pre-built wheels
instead of compiling from source.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add temp_output directory and pass real path instead of empty string:
- Create temp_output/ directory
- Pass to model.infer as output_path parameter
- Clean up both temp directories at end
The model expects a real directory path, not empty string.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Use local temp_images directory instead of system temp
Replace tempfile.mkdtemp() with simple local directory:
- Create "temp_images" in current working directory
- More reliable in containerized environments like HF Jobs
- Simpler and easier to debug
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replace NamedTemporaryFile with simple temp directory approach:
- Create temp dir once at start
- Reuse single temp file path for all images
- Clean up temp dir at end
This matches the official example pattern where model.infer()
expects a real file path string.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Pin transformers version for DeepSeek-OCR compatibility
Fix ImportError with LlamaFlashAttention2 by pinning to
transformers==4.46.3 and tokenizers==0.20.3 as required
by the model's custom code.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>