Instructions to use VietAlphaLabs/SenOCR-Vi-INT8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VietAlphaLabs/SenOCR-Vi-INT8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="VietAlphaLabs/SenOCR-Vi-INT8") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("VietAlphaLabs/SenOCR-Vi-INT8") model = AutoModelForMultimodalLM.from_pretrained("VietAlphaLabs/SenOCR-Vi-INT8", 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 VietAlphaLabs/SenOCR-Vi-INT8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VietAlphaLabs/SenOCR-Vi-INT8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VietAlphaLabs/SenOCR-Vi-INT8", "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/VietAlphaLabs/SenOCR-Vi-INT8
- SGLang
How to use VietAlphaLabs/SenOCR-Vi-INT8 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 "VietAlphaLabs/SenOCR-Vi-INT8" \ --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": "VietAlphaLabs/SenOCR-Vi-INT8", "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 "VietAlphaLabs/SenOCR-Vi-INT8" \ --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": "VietAlphaLabs/SenOCR-Vi-INT8", "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 VietAlphaLabs/SenOCR-Vi-INT8 with Docker Model Runner:
docker model run hf.co/VietAlphaLabs/SenOCR-Vi-INT8
SenOCR-Vi 路 Research page 路 VietAlpha Lab
SenOCR-Vi INT8 is the efficiency-focused release of SenOCR-Vi, VietAlpha Lab's Vietnamese-specialized document OCR model. At less than half the size of the full-precision checkpoint, it is built for on-device OCR: smartphones, laptops and edge hardware, with no server round-trip.
Highlights
- Built for the edge: a 1.56 GB checkpoint, 59% smaller than the 3.83 GB original, compact enough to fit in the memory of modern smartphones.
- Efficient by design: a ~0.96B-parameter model that reads Vietnamese documents directly on the device, keeping documents private and costs low.
- Targeted quantization: INT8 weights on the language decoder, where SenOCR-Vi's Vietnamese fine-tuning lives. The vision encoder, projector, embeddings and output head stay in BF16.
- No calibration step: per-row symmetric INT8 weight-only quantization with torchao. Activations run in BF16.
- Native transformers loading: one
from_pretrainedcall with no remote code. - Same interface: prompts, chat template and outputs match SenOCR-Vi and PaddleOCR-VL-1.6.
- Apache 2.0: free for commercial use, customization and redistribution.
Quick start
pip install "transformers>=5.0.0" torchao torch pillow
from PIL import Image
import torch
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "VietAlphaLabs/SenOCR-Vi-INT8"
model = AutoModelForImageTextToText.from_pretrained(
model_id, dtype=torch.bfloat16, device_map="auto"
).eval()
processor = AutoProcessor.from_pretrained(model_id)
image = Image.open("document.png").convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "OCR:"},
],
}
]
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=512)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Load with
dtype=torch.bfloat16. Without it, the non-quantized modules load in FP32.
Download the model
hf download VietAlphaLabs/SenOCR-Vi-INT8 --local-dir SenOCR-Vi-INT8/
Evaluation
The published SenOCR-Vi benchmarks (82.83 Vietnamese document composite, 86.7% Vietnamese text recognition) were measured on the full-precision release. Separate scores for the INT8 build are not yet available, so validate it on your own documents before production use.
See the SenOCR-Vi model card for full evaluation, training, data and limitations.
License
SenOCR-Vi INT8 is released under the Apache License 2.0, the same license as SenOCR-Vi and PaddleOCR-VL-1.6.
Citation
@misc{vietalphalab2026senocrvi,
title={SenOCR-Vi: A Vietnamese-Specialized Document OCR Model},
author={VietAlpha Lab},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/VietAlphaLabs/SenOCR-Vi},
}
- Downloads last month
- 14