Models for Handwritten Text Recognition
Collection
This collection contains models that we created at the National Archives for HTR • 6 items • Updated • 8
How to use Riksarkivet/trocr-base-handwritten-hist-swe-1 with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "image-to-text" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("image-to-text", model="Riksarkivet/trocr-base-handwritten-hist-swe-1") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("Riksarkivet/trocr-base-handwritten-hist-swe-1")
model = AutoModelForMultimodalLM.from_pretrained("Riksarkivet/trocr-base-handwritten-hist-swe-1")Base model
microsoft/trocr-base-handwritten