|
|
--- |
|
|
tags: |
|
|
- ocr |
|
|
- document-processing |
|
|
- lighton-ocr |
|
|
- markdown |
|
|
- uv-script |
|
|
- generated |
|
|
--- |
|
|
|
|
|
# Document OCR using LightOnOCR-0.9B-32k-1025 |
|
|
|
|
|
This dataset contains OCR results from images in [stckmn/ocr-input-Directive017-1761353279](https://huggingface.co/datasets/stckmn/ocr-input-Directive017-1761353279) using LightOnOCR, a fast and compact 1B OCR model. |
|
|
|
|
|
## Processing Details |
|
|
|
|
|
- **Source Dataset**: [stckmn/ocr-input-Directive017-1761353279](https://huggingface.co/datasets/stckmn/ocr-input-Directive017-1761353279) |
|
|
- **Model**: [lightonai/LightOnOCR-0.9B-32k-1025](https://huggingface.co/lightonai/LightOnOCR-0.9B-32k-1025) |
|
|
- **Vocabulary Size**: 32k tokens |
|
|
- **Number of Samples**: 21 |
|
|
- **Processing Time**: 1.2 min |
|
|
- **Processing Date**: 2025-10-25 00:50 UTC |
|
|
|
|
|
### Configuration |
|
|
|
|
|
- **Image Column**: `image` |
|
|
- **Output Column**: `markdown` |
|
|
- **Dataset Split**: `train` |
|
|
- **Batch Size**: 32 |
|
|
- **Target Image Size**: 1288px (longest dimension) |
|
|
- **Max Model Length**: 8,192 tokens |
|
|
- **Max Output Tokens**: 6,500 |
|
|
- **Temperature**: 0.2 |
|
|
- **Top P**: 0.9 |
|
|
- **GPU Memory Utilization**: 80.0% |
|
|
|
|
|
## Model Information |
|
|
|
|
|
LightOnOCR is a fast, compact OCR model that excels at: |
|
|
- β‘ **Production Speed** - 5.71 pages/second on H100 GPU |
|
|
- π― **Compact Size** - Only 1B parameters |
|
|
- π **LaTeX formulas** - Mathematical notation in LaTeX format |
|
|
- π **Tables** - Extracted and formatted as markdown |
|
|
- π **Document structure** - Hierarchy and layout preservation |
|
|
- π **Multilingual** - Optimized for European languages |
|
|
- π€ **Flexible vocabulary** - 151k/32k/16k token variants |
|
|
|
|
|
### Vocabulary Variants |
|
|
|
|
|
- **151k tokens**: Full vocabulary, supports all languages |
|
|
- **32k tokens**: European languages optimized (~12% faster decoding) |
|
|
- **16k tokens**: European languages optimized (~12% faster decoding) |
|
|
|
|
|
## Dataset Structure |
|
|
|
|
|
The dataset contains all original columns plus: |
|
|
- `markdown`: The extracted text in markdown format with LaTeX formulas |
|
|
- `inference_info`: JSON list tracking all OCR models applied to this dataset |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from datasets import load_dataset |
|
|
import json |
|
|
|
|
|
# Load the dataset |
|
|
dataset = load_dataset("{output_dataset_id}", split="train") |
|
|
|
|
|
# Access the markdown text |
|
|
for example in dataset: |
|
|
print(example["markdown"]) |
|
|
break |
|
|
|
|
|
# View all OCR models applied to this dataset |
|
|
inference_info = json.loads(dataset[0]["inference_info"]) |
|
|
for info in inference_info: |
|
|
print(f"Column: {info['column_name']} - Model: {info['model_id']}") |
|
|
``` |
|
|
|
|
|
## Reproduction |
|
|
|
|
|
This dataset was generated using the [uv-scripts/ocr](https://huggingface.co/datasets/uv-scripts/ocr) LightOnOCR script: |
|
|
|
|
|
```bash |
|
|
uv run https://huggingface.co/datasets/uv-scripts/ocr/raw/main/lighton-ocr.py \ |
|
|
stckmn/ocr-input-Directive017-1761353279 \ |
|
|
<output-dataset> \ |
|
|
--vocab-size 32k \ |
|
|
--image-column image \ |
|
|
--batch-size 32 |
|
|
``` |
|
|
|
|
|
## Performance |
|
|
|
|
|
- **Processing Speed**: ~0.29 images/second |
|
|
- **Benchmark Score**: 76.1% overall (across diverse document types) |
|
|
- **Optimization**: Native resolution ViT + lightweight decoder |
|
|
|
|
|
Generated with π€ [UV Scripts](https://huggingface.co/uv-scripts) |
|
|
|