Model reference · open weights

thai-trocr

LLMs openthaigpt Image→text 1 build Open weights 638 dl/mo

thai-trocr is an open-weight language model from openthaigpt. thai-trocr (FP32) weighs 206 MB; the smallest configuration that runs it is RTX 3060 12 GB.

For self-hosting, compare this build's requirements below with the GPU you plan to rent.

  • ThaiTrOCR is a 103M parameter image-to-text model developed by openthaigpt for Optical Character Recognition in Thai and English.
  • It uses a Vision Transformer encoder and an Electra-based decoder to process handwritten text-line images.
  • The model is released under the Apache 2.0 license.

Summary of the openthaigpt/thai-trocr model card, 2026-10-01

What it is

Released byopenthaigpt
Released2024-09-29
Parameters103M
VRAM206 MB for the weights

What it runs on

Memory and cards for thai-trocr (FP32)

206 MBweights, file size
762 MBruntime overhead, at least

How much memory each request adds isn't estimated yet for this architecture. The weights need at least the cards below, plus room for the context.

CardWeights alone
RTX 3060 12 GBfits
RTX 4060 Ti 16 GBfits
RTX 3090 24 GBfits
RTX 4090 24 GBfits
RTX 5090 32 GBfits
L40S 48 GBfits
A100 80 GBfits
H100 80 GBfits
RTX PRO 6000 Blackwell 96 GBfits
DGX Spark (GB10) 128 GB unifiedfits
H200 141 GBfits
B200 180 GBfits

From the model card

What openthaigpt says about thai-trocr

Read the model card

Introduction

ThaiTrOCR is a fine-tuned version of the TrOCR base handwritten model, specifically crafted for Optical Character Recognition (OCR) in both Thai and English. This multilingual model adeptly processes handwritten text-line images in both languages, leveraging the TrOCR architecture, which combines a Vision Transformer encoder with an Electra-based text decoder. Designed to be compact and lightweight, ThaiTrOCR is optimized for efficient deployment in resource-constrained environments while achieving high accuracy in character recognition.

  • Encoder: TrOCR Base Handwritten
  • Decoder: Electra Small (Trained with Thai corpus)

Training Dataset

  • pythainlp/thai-wiki-dataset-v3
  • pythainlp/thaigov-corpus
  • Salesforce/wikitext

How to Use

Here’s how to use this model in PyTorch:

from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
import requests

# Load processor and model
processor = TrOCRProcessor.from_pretrained('openthaigpt/thai-trocr')
model = VisionEncoderDecoderModel.from_pretrained('openthaigpt/thai-trocr')

# Load an image
url = 'your_image_url_here'
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")

# Process and generate text
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(generated_text)

Model Performance Comparison

This section details the performance comparison between the open-source ThaiTrOCR model and other widely-used OCR systems, namely EasyOCR and Tesseract. The table below highlights their respective performance across various document types based on the average Character Error Rate (CER).

Document TypeThaiTrOCREasyOCRTesseract
Handwritten0.1900340.4107381.032375
PDF Document0.0575970.0859370.761595
PDF Document (EN-TH)0.0539680.3080751.061107
Real Document0.1474400.2934820.915707
Scene Text0.1341820.3905832.408704
Adjusted Mean0.1236000.2984741.269101

Disclaimer: The test dataset at https://huggingface.co/datasets/openthaigpt/thai-ocr-evaluation includes only 104 images, which may limit the generalizability of these results. We are increasing the number of the test dataset.

Key Insights

  • Character Error Rate (CER): This metric evaluates the percentage of characters that were incorrectly predicted by the model. A lower CER indicates better performance. As shown in the table, ThaiTrOCR consistently outperforms EasyOCR and Tesseract across all document types, with a significantly lower average CER, making it the most accurate model in the comparison.
  • Model Performance: The ThaiTrOCR model is particularly effective with PDF documents (both Thai-only and bilingual English-Thai texts), and shows substantial improvement over competing models in reading scene text and handwritten content.
  • Tesseract Limitation: It’s important to note that Tesseract only supports single-language input at a time in this comparison. For the purposes of this benchmark, it was tested using only the Thai language setting, which might have contributed to its higher CER values.
  • The evaluation dataset is sourced from the openthaigpt/thai-ocr-evaluation.

Sponsors

Authors

  • Suchut Sapsathien (suchut@outlook.com)
  • Jillaphat Jaroenkantasima (autsadang41@gmail.com)

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

How it works

How language models work

Your prompttext / messagesTransformerattention over tokensNext-token loopgenerate + streamResponsetext · tool callsA language model reads your tokens and predicts the next one, again and again, streaming the reply back.
© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms