lightonai/LightOnOCR-2-1B
- License
- apache-2.0
- Size
- not mirrored yet
No official torrent yet β requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from lightonai/LightOnOCR-2-1B
All models by lightonai βNo official torrent yet β requesting it tells the flock what to host next. You cannot seed a catalog-only page.
Cataloged from lightonai/LightOnOCR-2-1B
All models by lightonai βπ Paper | π Blog | π Demo | π Dataset | π Finetuning
Best OCR model . LightOnOCR-2-1B is LightOn's flagship OCR model, refined with RLVR training for maximum accuracy. We recommend this variant for most OCR tasks.
LightOnOCR-2 is an efficient end-to-end 1B-parameter vision-language model for converting documents (PDFs, scans, images) into clean, naturally ordered text without relying on brittle pipelines. This second version is trained on a larger and higher-quality corpus with stronger French, arXiv, and scan coverage, improved LaTeX handling, and cleaner normalization. LightOnOCR-2 achieves state-of-the-art performance on OlmOCR-Bench while being ~9Γ smaller and significantly faster than competing approaches.
π Paper | π Blog Post | π Demo | π Dataset | π BBox Dataset | π Finetuning Notebook | LightOn blog entry
See the paper for full benchmark details and methodology.
Note: LightOnOCR-2 is avaible in latest transformers release starting from v5.
LightOnOCR-2 is fully differentiable and supports:
For fine-tuning, we recommend starting with the LightOnOCR-2-1B-base variant.
Apache License 2.0
The project received funding from the BPI Scribe project.
uv pip install transformers # => 5.0.0uv pip install pillow pypdfium2import torchfrom transformers import LightOnOcrForConditionalGeneration, LightOnOcrProcessor
device = "mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"dtype = torch.float32 if device == "mps" else torch.bfloat16
model = LightOnOcrForConditionalGeneration.from_pretrained("lightonai/LightOnOCR-2-1B", torch_dtype=dtype).to(device)processor = LightOnOcrProcessor.from_pretrained("lightonai/LightOnOCR-2-1B")
url = "https://huggingface.co/datasets/hf-internal-testing/fixtures_ocr/resolve/main/SROIE-receipt.jpeg"
conversation = [{"role": "user", "content": [{"type": "image", "url": url}]}]
inputs = processor.apply_chat_template( conversation, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt",)inputs = {k: v.to(device=device, dtype=dtype) if v.is_floating_point() else v.to(device) for k, v in inputs.items()}
output_ids = model.generate(**inputs, max_new_tokens=1024)generated_ids = output_ids[0, inputs["input_ids"].shape[1]:]output_text = processor.decode(generated_ids, skip_special_tokens=True)print(output_text)vllm serve lightonai/LightOnOCR-2-1B \ --limit-mm-per-prompt '{"image": 1}' --mm-processor-cache-gb 0 --no-enable-prefix-cachingimport base64import requestsimport pypdfium2 as pdfiumimport io
ENDPOINT = "http://localhost:8000/v1/chat/completions"MODEL = "lightonai/LightOnOCR-2-1B"
# Download PDF from arXivpdf_url = "https://arxiv.org/pdf/2412.13663"pdf_data = requests.get(pdf_url).content
# Open PDF and convert first page to imagepdf = pdfium.PdfDocument(pdf_data)page = pdf[0]# Render at 200 DPI (scale factor = 200/72 β 2.77)pil_image = page.render(scale=2.77).to_pil()
# Convert to base64buffer = io.BytesIO()pil_image.save(buffer, format="PNG")image_base64 = base64.b64encode(buffer.getvalue()).decode('utf-8')
# Make requestpayload = { "model": MODEL, "messages": [{ "role": "user", "content": [{ "type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"} }] }], "max_tokens": 4096, "temperature": 0.2, "top_p": 0.9,}
response = requests.post(ENDPOINT, json=payload)text = response.json()['choices'][0]['message']['content']print(text)@misc{lightonocr2_2026, title = {LightOnOCR: A 1B End-to-End Multilingual Vision-Language Model for State-of-the-Art OCR}, author = {Said Taghadouini and Adrien Cavaill\`{e}s and Baptiste Aubertin}, year = {2026}, howpublished = {\url{https://arxiv.org/abs/2601.14251}}}