Model reference · open weights
TrOCR_german_handwritten is an open-weight language model from fhswf. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | fhswf |
|---|---|
| Type | Language models |
| Task | Image→text |
| Parameters (lead) | 558M |
| Runs with | transformers |
| Released | 2024-05-29 |
| Popularity | 967 downloads / month |
| Licence | Commercial licence needed |
About
TrOCR model fine-tuned on the german_handwriting. It was introduced in the paper TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models by Li et al. and first released in this repository.
Here is how to use this model in PyTorch:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
import requests
# load image from the IAM database
url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
processor = TrOCRProcessor.from_pretrained('fhswf/TrOCR_german_handwritten')
model = VisionEncoderDecoderModel.from_pretrained('fhswf/TrOCR_german_handwritten')
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]
You can use the raw model for optical character recognition (OCR) on single text-line images of german handwriting.
This model was finetuned on german_handwriting.
Levenshtein: 1.85 WER (Word Error Rate): 17.5% CER (Character Error Rate): 4.1%
BibTeX:
@misc{li2021trocr,
title={TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models},
author={Minghao Li and Tengchao Lv and Lei Cui and Yijuan Lu and Dinei Florencio and Cha Zhang and Zhoujun Li and Furu Wei},
year={2021},
eprint={2109.10282},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys trocr-german-handwritten for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (trocr-german-handwritten below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/chat/completions \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"trocr-german-handwritten","messages":[{"role":"user","content":"Hello"}]}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.