TrOCR

Microsoft's Transformer OCR for single text lines. Pick the printed or handwritten tag and BOAT transcribes the line you box.

OCRMicrosoftMIT AND Apache-2.0
Recommended3/10
VRAM1.3 GBweights, plus ~0.5 GB reserve
Tools1across 1 annotation type
Runs onmacOS1 of 4 runtime profiles

Install

boat model install trocr

Without a tag BOAT installs trocr:printed. Tags install side by side, so you can keep several.Download: 1.3 GB of weights.

Overview

Summarized from the upstream project, last reviewed Oct 22, 2026.

TrOCR (AAAI 2023) is an end-to-end text recognizer that pairs a pre-trained image Transformer with a pre-trained text Transformer, generating the transcription wordpiece by wordpiece. It reads one cropped text line at a time, so draw tight boxes around lines rather than whole paragraphs.

Tag Trained for
printed Receipts, forms and other printed text
handwritten Handwritten lines

Tools

What TrOCR adds to the annotation editor. Each example loops what you do and what comes back.

Auto Type example on ocr

Auto Type

BoxText

OCR

Draw boxes as you normally would. Every new box becomes a prompt, and similar objects are suggested automatically for you to accept.

  • Apply
  • Runs automatically

Tags

Each tag is an installable variant, such as a size or quantization, with its own weights.

TagWeightsPlatformsInstall
trocr:printeddefault1.3 GB · 8 filesmacOS
trocr:handwritten1.3 GB · 8 filesmacOS

Platforms

BOAT picks the runtime profile that matches your machine. Only that profile's code is downloaded.

macOS · Metal

Apple silicon (MPS)

Python 3.11 · 25 KB

Linux · CUDA 12.8

NVIDIA, incl. Blackwell

Not supported

Linux · CUDA 12.6

NVIDIA GPUs

Not supported

Linux · CPU

x86_64 CPU

Not supported

License

BOAT's adapter code is Apache-2.0. The model's own code and weights keep their upstream license:MIT AND Apache-2.0.

Bundled license files: BOAT-APACHE-2.0.txt, NOTICE.md, TRANSFORMERS-APACHE-2.0.txt, UNILM-MIT.txt

Package details

Package
trocr
Version
0.0.3
Type
Common model
BOAT Core
≥ 0.1.0 · < 1.0.0
Inference timeout
600s
Manifest SHA-256
338c2681d9ac0dd876eeacddd0eda4a93e0a6afdddea211ce50543c14933913c
Upstream notice
# TrOCR package notices

- BOAT adapter, runtime and tests: Apache-2.0; see `BOAT-APACHE-2.0.txt`.
- Microsoft TrOCR release: [microsoft/unilm, trocr](https://github.com/microsoft/unilm/tree/master/trocr),
  MIT; see `UNILM-MIT.txt`. The official release links the Hugging Face checkpoints below.
- Vendored ViT, TrOCR decoder, image processing and RoBERTa decoding derive from
  [Hugging Face Transformers 4.57.6](https://github.com/huggingface/transformers/tree/v4.57.6),
  Apache-2.0; see `TRANSFORMERS-APACHE-2.0.txt` and the vendor's `LICENSE`.
  Copyright 2021 Google AI, Ross Wightman, the Fairseq Authors and the HuggingFace Inc. team;
  Copyright 2022 the HuggingFace Inc. team; Copyright 2018 the Open AI Team Authors
  and the HuggingFace Inc. team.
  Frozen revision, source hashes and BOAT modifications are documented in
  `models/macos-metal/vendor/UPSTREAM_REVISION` and its `README.md`.

## Checkpoints and language scope

| Tag | Official model card | Revision | Language evidence |
|---|---|---|---|
| `printed` | [microsoft/trocr-base-printed](https://huggingface.co/microsoft/trocr-base-printed) | `93450be3f1ed40a930690d951ef3932687cc1892` | SROIE English receipt text, single-line OCR |
| `handwritten` | [microsoft/trocr-base-handwritten](https://huggingface.co/microsoft/trocr-base-handwritten) | `eaacaf452b06415df8f10bb6fad3a4c11e609406` | IAM English handwritten text, single-line OCR |

The printed model card does not provide a separate license field; the upstream
TrOCR release is MIT. The handwritten model card explicitly declares MIT.
No additional license acceptance is required. Checkpoint contents are unchanged;
local paths, exact sizes and SHA256 hashes are recorded in `weights/<tag>/weights.json`.
Weights are downloaded separately and excluded from Git and source archives.

Test images are BOAT-generated synthetic text and blank/color probes, not redistributed
SROIE or IAM samples. See `tests/fixtures/README.md` for provenance.

## Vendored source provenance

`UPSTREAM_REVISION` records Transformers v4.57.6 by its commit, 753d61104116eefc8ffc977327b441ee0c8d599f.
(An earlier record held the annotated tag object id 7dacdf4543ca4fe081f99dedacdb70d8df0fd366, which is not a commit.)

SHA256 of the upstream files:

```text
src/transformers/models/trocr/modeling_trocr.py d1f012f731c5170c151476c66caa62a9a9444793123516872dabce18e5d63ac0
src/transformers/models/vit/modeling_vit.py 069e0958c10e806551a2e1d2421cd26e6bff21f7c65aeb9f0f3c0dbde1a88ca5
src/transformers/models/vit/image_processing_vit.py f14f573808318cec0bb7d1de26dc21a6a18dbc303884cd9988840c8e12ab1e0e
src/transformers/models/roberta/tokenization_roberta.py 16d29ac791790a0e2e251eda5aceb697d4e9d2e0dc54b5b675929fad87daaeb8
```
↑↓ navigate↵ open