Image-Text-to-Text
Transformers
Safetensors
mistral3
text-generation
ocr
document-understanding
vision-language
pdf
tables
forms
conversational
Eval Results
🇪🇺 Region: EU
Instructions to use lightonai/LightOnOCR-2-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lightonai/LightOnOCR-2-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lightonai/LightOnOCR-2-1B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSeq2SeqLM processor = AutoProcessor.from_pretrained("lightonai/LightOnOCR-2-1B") model = AutoModelForSeq2SeqLM.from_pretrained("lightonai/LightOnOCR-2-1B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lightonai/LightOnOCR-2-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lightonai/LightOnOCR-2-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOnOCR-2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/lightonai/LightOnOCR-2-1B
- SGLang
How to use lightonai/LightOnOCR-2-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "lightonai/LightOnOCR-2-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOnOCR-2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "lightonai/LightOnOCR-2-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightonai/LightOnOCR-2-1B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use lightonai/LightOnOCR-2-1B with Docker Model Runner:
docker model run hf.co/lightonai/LightOnOCR-2-1B
Commit History
-
Point new_version to LightOnOCR-3-4B
Verified signaturebe7c413
-
Add MDPBench private evaluation result (#43)
- Add MDPBench private evaluation result (306237a921024931f8baef3b3e1b2c83383cb576) - Repair MDPBench evaluation results (3d39178a80a774ce677dba983fb99629ec33ce80) Co-authored-by: Delores Lin <Delores-Lin@users.noreply.huggingface.co>c97bd37
-
Update README.md
Verified signature20d9016
-
Add MDPBench evaluation results (#40)
- Add MDPBench evaluation results (1e5cef580ef588e818874a1149b5f11dd7eb6b61) Co-authored-by: Delores Lin <Delores-Lin@users.noreply.huggingface.co>7d6fa26
-
Add ParseBench evaluation results (#38)
- Add ParseBench evaluation results (d1b29d439efc34f46d6f1e1dc098319078ea3a82) Co-authored-by: Boyang Zhang <boyang-runllama@users.noreply.huggingface.co>6f7bd5b
-
Update .eval_results/olmocrbench.yaml
Verified signaturec29612a
-
Update .eval_results/olmocrbench.yaml
Verified signature1f8c670 -
Update .eval_results/olmocrbench.yaml
Verified signatured0ff259 -
Add overall OlmOCRBench results (#31)
- Add overall OlmOCRBench results (aaebe21c5e7f620788b902ec86edae89bf47d795) - Add notes (b5aae08374d44ad0c3e7ae0e0ee3790c39fc4d04) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>cd38431
-
Add OlmOCRBench evaluation results (#29)
- Add OlmOCRBench evaluation results (396fb1f6b7e2c50b0c25133f4aa731b0b7061695) Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>e6039be
-
Update README.md
Verified signaturec70b084 -
Update README.md
Verified signatured49910d -
Update README.md
Verified signature5e0023e -
update readme (#23)
- update readme (c6ad8bf3851b5d436f1a9c289558f4bb81bbf3ee) Co-authored-by: C <IgorC@users.noreply.huggingface.co>371e6cb
-
transformers v5 support for LightOnOCR
Verified signature2838347
-
Update README.md
Verified signature17a629e -
Update README.md
Verified signaturece3dc3d
-
Fix pipeline_tag 🤗 (#3)
Verified signature- Fix pipeline_tag 🤗 (ef65c2567b40b0a766d8f618df7f3da244e6f611) Co-authored-by: merve <merve@users.noreply.huggingface.co>6df51f0
-
Update README.md
Verified signature9747c38 -
Update README.md
Verified signaturec5e7f69 -
Upload 2 files
Verified signaturef2932b1 -
Update README.md
Verified signature4f0ee23
-
Upload model.safetensors with huggingface_hub
9641ef2
-
Update README.md
2b336bb -
Update README.md
2676f7d -
Create README.md
b6b0cc8 -
Upload folder using huggingface_hub
0f36139 -
initial commit
8481905