HiepOCR: A Fast Model for Handwritten Text Recognition
2 min readupdated
HiepOCR is a specialized 1.0B parameter multimodal model (VLM) designed for accurate recognition and extraction of handwritten text, documents, letters, and postal mail. Built on the InternViT architecture and Qwen2.5-0.5B decoder, it delivers high processing speeds without hallucinations. The solution is ideal for automating the processing of forms, waybills, and archival handwritten records.
Key features
- High speed: decoding up to 50–52 tokens per second on a GPU with CPU deployment support
- Auto-rotation: automatic orientation detection and image rotation in milliseconds
- Accuracy: minimal Character Error Rate (CER) and a low false-positive rate
- Flexible deployment: support for native runtimes, the GGUF format, vLLM, and the Hugging Face Transformers ecosystem
What you can do
- Mail processing: automatically read addresses and recipient data from envelopes and packages
- Document digitization: convert scans of handwritten applications and receipts into structured formats
- API integration: deploy a fast recognition service via vLLM to handle client requests
- Mobile solutions: run compact quantized GGUF versions of the model on edge devices
Example
import torch
from PIL import Image
from transformers import AutoModel, AutoTokenizer
model_id = "Hiep3215/HiepOCR"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(model_id, torch_dtype=torch.bfloat16, trust_remote_code=True).eval().cuda()
image = Image.open("phong_bi.jpg").convert("RGB")
prompt = "\nЧи нхан данг ва трич xuat чу вьет тай:"
response = model.chat(tokenizer, image, prompt, dict(max_new_tokens=256))
print(response)
Read more
Details• Architecture: InternViT-300M + Qwen2.5-0.5B-Instruct
• Metrics: Micro-CER 7.14%, Micro-WER 12.45%
• License: Apache-2.0
• Features: native Rust, GGUF, and vLLM support










Comments