GLM-OCR SDK sets max_tokens=16384 but our max_model_len is 8192.
vLLM silently caps generation, making the high default misleading.
Align default to 8192 and document the SDK discrepancy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove `[hf_transfer]` extra from PEP 723 dependencies (5 scripts)
- Replace `HF_HUB_ENABLE_HF_TRANSFER=1` with `HF_XET_HIGH_PERFORMANCE=1` (4 scripts)
- Hub now uses Xet storage backend; hf_transfer is deprecated
Ref: https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfxethighperformance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Standardizing metadata tags across uv-scripts organization
for better discoverability of HF Jobs-compatible scripts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 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>