AI SeedbankHelp preserve open and free AI for humanity's future

← All models

typhoon-ai_typhoon-ocr-3b

typhoon-ai · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


library_name: transformers language:

  • en
  • th base_model:
  • Qwen/Qwen2.5-VL-3B-Instruct tags:
  • OCR
  • vision-language
  • document-understanding
  • multilingual license: apache-2.0

Typhoon-OCR-3B: A bilingual document parsing model built specifically for real-world documents in Thai and English inspired by models like olmOCR based on Qwen2.5-VL-Instruction.

By using this model, you agree to the OpenTyphoon Terms and Conditions and acknowledge the Privacy Notice: https://opentyphoon.ai/tac · https://opentyphoon.ai/privacy

Try our demo available on Demo

Code / Examples available on Github

Release Blog available on OpenTyphoon Blog

Technical Report on Arxiv

*Remark: This model is intended to be used with a specific prompt only; it will not work with any other prompts.

*Remark: If you want to run the model locally, we recommend using the Ollama build at https://ollama.com/scb10x. We’ve found that the GGUF files for llama.cpp or LM Studio may suffer from accuracy issues.

Real-World Document Support

1. Structured Documents: Financial reports, Academic papers, Books, Government forms

Output format:

  • Markdown for general text
  • HTML for tables (including merged cells and complex layouts)
  • Figures, charts, and diagrams are represented using figure tags for structured visual understanding

Each figure undergoes multi-layered interpretation:

  • Observation: Detects elements like landscapes, buildings, people, logos, and embedded text
  • Context Analysis: Infers context such as location, event, or document section
  • Text Recognition: Extracts and interprets embedded text (e.g., chart labels, captions) in Thai or English
  • Artistic & Structural Analysis: Captures layout style, diagram type, or design choices contributing to document tone
  • Final Summary: Combines all insights into a structured figure description for tasks like summarization and retrieval

2. Layout-Heavy & Informal Documents: Receipts, Menus papers, Tickets, Infographics

Output format:

  • Markdown with embedded tables and layout-aware structures

Performance

Summary of Findings

Typhoon OCR outperforms both GPT-4o and Gemini 2.5 Flash in Thai document understanding, particularly on documents with complex layouts and mixed-language content. However, in the Thai books benchmark, performance slightly declined due to the high frequency and diversity of embedded figures. These images vary significantly in type and structure, which poses challenges for our current figure tag parsing. This highlights a potential area for future improvement—specifically, in enhancing the model's image understanding capabilities. For this version, our primary focus has been on achieving high-quality OCR for both English and Thai text. Future releases may extend support to more advanced image analysis and figure interpretation.

Usage Example

(Recommended): Full inference code available on Colab

(Recommended): Using Typhoon-OCR Package

pip install typhoon-ocr
from typhoon_ocr import ocr_document

# please set env TYPHOON_OCR_API_KEY or OPENAI_API_KEY to use this function
markdown = ocr_document("test.png")
print(markdown)

(Recommended): Local Model via vllm (GPU Required):

pip install vllm
vllm serve scb10x/typhoon-ocr-3b --max-model-len 32000 --served-model-name typhoon-ocr-preview # OpenAI Compatible at http://localhost:8000 (or other port)
# then you can supply base_url in to ocr_document
from typhoon_ocr import ocr_document
markdown = ocr_document('image.png', base_url='http://localhost:8000/v1', api_key='no-key')
print(markdown)

To read more about vllm

Run Manually

Below is a partial snippet. You can run inference using either the API or a local model.

API:

from typing import Callable
from openai import OpenAI
from PIL import Image
from typhoon_ocr.ocr_utils import render_pdf_to_base64png, get_anchor_text

PROMPTS = {
    "default": lambda base_text: (f"Below is an image of a document page along with its dimensions. "
        f"Simply return the markdown representation of this document, presenting tables in markdown format as they naturally appear.\n"
        f"If the document contains images, use a placeholder like dummy.png for each image.\n"
        f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
        f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"),
    "structure": lambda base_text: (
        f"Below is an image of a document page, along with its dimensions and possibly some raw textual content previously extracted from it. "
        f"Note that the text extraction may be incomplete or partially missing. Carefully consider both the layout and any available text to reconstruct the document accurately.\n"
        f"Your task is to return the markdown representation of this document, presenting tables in HTML format as they naturally appear.\n"
        f"If the document contains images or figures, analyze them and include the tag <figure>IMAGE_ANALYSIS</figure> in the appropriate location.\n"
        f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
        f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"
    ),
}

def get_prompt(prompt_name: str) -> Callable[[str], str]:
    """
    Fetches the system prompt based on the provided PROMPT_NAME.

    :param prompt_name: The identifier for the desired prompt.
    :return: The system prompt as a string.
    """
    return PROMPTS.get(prompt_name, lambda x: "Invalid PROMPT_NAME provided.")



# Render the first page to base64 PNG and then load it into a PIL image.
image_base64 = render_pdf_to_base64png(filename, page_num, target_longest_image_dim=1800)
image_pil = Image.open(BytesIO(base64.b64decode(image_base64)))

# Extract anchor text from the PDF (first page)
anchor_text = get_anchor_text(filename, page_num, pdf_engine="pdfreport", target_length=8000)

# Retrieve and fill in the prompt template with the anchor_text
prompt_template_fn = get_prompt(task_type)
PROMPT = prompt_template_fn(anchor_text)

messages = [{
        "role": "user",
        "content": [
            {"type": "text", "text": PROMPT},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}},
        ],
    }]
# send messages to openai compatible api
openai = OpenAI(base_url="https://api.opentyphoon.ai/v1", api_key="TYPHOON_API_KEY")
response = openai.chat.completions.create(
          model="typhoon-ocr-preview",
          messages=messages,
          max_tokens=16384,
          temperature=0.1,
          top_p=0.6,
          extra_body={
              "repetition_penalty": 1.2,
          },
      )
text_output = response.choices[0].message.content
print(text_output)

(Not Recommended): Local Model - Transformers (GPU Required):

# Initialize the model
model = Qwen2_5_VLForConditionalGeneration.from_pretrained("scb10x/typhoon-ocr-3b", torch_dtype=torch.bfloat16 ).eval()
processor = AutoProcessor.from_pretrained("scb10x/typhoon-ocr-3b")

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Apply the chat template and processor
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
main_image = Image.open(BytesIO(base64.b64decode(image_base64)))

inputs = processor(
          text=[text],
          images=[main_image],
          padding=True,
          return_tensors="pt",
      )
inputs = {key: value.to(device) for (key, value) in inputs.items()}

# Generate the output
output = model.generate(
                  **inputs,
                  temperature=0.1,
                  max_new_tokens=12000,
                  num_return_sequences=1,
                  repetition_penalty=1.2,
                  do_sample=True,
              )
# Decode the output
prompt_length = inputs["input_ids"].shape[1]
new_tokens = output[:, prompt_length:]
text_output = processor.tokenizer.batch_decode(
          new_tokens, skip_special_tokens=True
      )
print(text_output[0])

Prompting

This model only works with the specific prompts defined below, where {base_text} refers to information extracted from the PDF metadata using the get_anchor_text function from the typhoon-ocr package. It will not function correctly with any other prompts.

PROMPTS = {
    "default": lambda base_text: (f"Below is an image of a document page along with its dimensions. "
        f"Simply return the markdown representation of this document, presenting tables in markdown format as they naturally appear.\n"
        f"If the document contains images, use a placeholder like dummy.png for each image.\n"
        f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
        f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"),
    "structure": lambda base_text: (
        f"Below is an image of a document page, along with its dimensions and possibly some raw textual content previously extracted from it. "
        f"Note that the text extraction may be incomplete or partially missing. Carefully consider both the layout and any available text to reconstruct the document accurately.\n"
        f"Your task is to return the markdown representation of this document, presenting tables in HTML format as they naturally appear.\n"
        f"If the document contains images or figures, analyze them and include the tag <figure>IMAGE_ANALYSIS</figure> in the appropriate location.\n"
        f"Your final output must be in JSON format with a single key `natural_text` containing the response.\n"
        f"RAW_TEXT_START\n{base_text}\nRAW_TEXT_END"
    ),
}

Generation Parameters

We suggest using the following generation parameters. Since this is an OCR model, we do not recommend using a high temperature. Make sure the temperature is set to 0 or 0.1, not higher.

temperature=0.1,
top_p=0.6,
repetition_penalty: 1.2

Hosting

We recommend to inference typhoon-ocr using vllm instead of huggingface transformers, and using typhoon-ocr library to ocr documents. To read more about vllm

pip install vllm
vllm serve scb10x/typhoon-ocr-3b --max-model-len 32000 --served-model-name typhoon-ocr-preview  # OpenAI Compatible at http://localhost:8000
# then you can supply base_url in to ocr_document
from typhoon_ocr import ocr_document
markdown = ocr_document('image.png', base_url='http://localhost:8000/v1', api_key='no-key')
print(markdown)

Intended Uses & Limitations

This is a task-specific model intended to be used only with the provided prompts. It does not include any guardrails or VQA capability. Due to the nature of large language models (LLMs), a certain level of hallucination may occur. We recommend that developers carefully assess these risks in the context of their specific use case.

Follow us

https://twitter.com/opentyphoon

Support

https://discord.gg/us5gAYmrxw

Citation

  • If you find Typhoon OCR useful for your work, please cite it using:
@misc{nonesung2026typhoonocropenvisionlanguage,
      title={Typhoon OCR: Open Vision-Language Model For Thai Document Extraction}, 
      author={Surapon Nonesung and Natapong Nitarach and Teetouch Jaknamon and Pittawat Taveekitworachai and Kunat Pipatanakul},
      year={2026},
      eprint={2601.14722},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2601.14722}, 
}

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:451338ca582a8185e50a427bb902e88e0aa9bc59&dn=typhoon-ai_typhoon-ocr-3b

Open magnet in torrent client · infohash 451338ca582a8185e50a427bb902e88e0aa9bc59

Files & hashes

PathSizesha1sha256
README.md12.1 KB (12,354 B)fcff1c03f4eb514176ad77b5c799f76188f654d07500c175777508a140fd7e33d861f5c8226a776d4f6be673247a03169e718302
added_tokens.json605 B (605 B)482ced4679301bf287ebb310bdd1790eb451423258b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
chat_template.json1.0 KB (1,049 B)13303be6f396b038cf397b34a8096819d403836b94174d7176c52a7192f96fc34eb2cf23c7c2059d63cdbfadca1586ba89731fb7
config.json1.3 KB (1,280 B)76eef524e1a13585c76944da303a5e98ea1edfb8196db3bf107cbeac053a60c8c3d746da6a71754bbdcc940498d8a7653bc56786
generation_config.json266 B (266 B)84b580616a0a63b34e4f4143d3b9270adccc37cd7b245e09fff697cefd0bce883222f538ae243ac8e080a035f6ccfb318ea09f09
merges.txt1.6 MB (1,671,853 B)31349551d90c7606f325fe0f11bbb8bd5fa0d7c78831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
model-00001-of-00002.safetensors4.65 GB (4,997,750,760 B)2619f33e71edbe90168bce57f738e0ec6a4b319f557e94b77b94326f1c289a48a1663646abe4ec6ae385b8d232d3d4b0c2c2dac5
model-00002-of-00002.safetensors2.34 GB (2,511,587,184 B)153aef09a828006f907223b96fe4b0265ec7dfc764d60df105a1da8514593e833c558d43ec493c76f8ccb42062eac14e8709e6c8
model.safetensors.index.json63.9 KB (65,448 B)97a2999665f3984dab7f46e4e28a3bb001c4a63ceafcf7eb80f0e63f73ef902b792726372d9a5ac90f7c724898006882705360da
preprocessor_config.json575 B (575 B)ee08cdd031dd2f138ce236b0c995b34b4b34a6a4549c158011407dfb750d9ec578047cf76f5bfe365cd0aa069a50137d3f98d9dd
special_tokens_map.json613 B (613 B)ac23c0aaa2434523c494330aeb79c5839537810376862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json10.9 MB (11,421,896 B)dff01364e9c19e8476160c3f079e58f1d85900e19c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
tokenizer_config.json5.6 KB (5,776 B)a2631ad3ed255e1c20d0639115a97752819452f40a6be425d5d62ec1904deb45e569c809d0973bd39a411452388f268a855e3183
vocab.json2.6 MB (2,776,833 B)4783fe10ac3adce15ac8f358ef5462739852c569ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910

Cite this release

Canonical URL
https://aiseedbank.org/models/typhoon-ai_typhoon-ocr-3b/
Slug
typhoon-ai_typhoon-ocr-3b
Infohash
451338ca582a8185e50a427bb902e88e0aa9bc59
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: typhoon-ai_typhoon-ocr-3b.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorytyphoon-ai/typhoon-ocr-3b
Revision (pinned)f5103a5450e4a6a6331e5fac6911aaff3d827acf
Fetched at2026-09-04T06:35:38Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-04T06:36:48Z

apache-2.07.01 GB (7,525,296,492 bytes)transformerssafetensorsqwen2_5_vlimage-text-to-textOCRvision-languagedocument-understandingmultilingualconversationaltext-generation-inferenceendpoints_compatible2 languages (en, th)paper: 2601.14722