Instructions to use horatio12/passenger-list-typed-reader with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use horatio12/passenger-list-typed-reader 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="horatio12/passenger-list-typed-reader")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("horatio12/passenger-list-typed-reader") model = AutoModelForMultimodalLM.from_pretrained("horatio12/passenger-list-typed-reader", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Passenger list typed reader
Reads one typed name from a strip cut out of a US ship passenger list. Fine-tuned from microsoft/trocr-base-printed on about 3,700 name strips from New York arrival lists, 1897 to 1957 (National Archives microfilm T715, scanned on archive.org).
Part of passenger-list-reader, which finds the name column, cuts one strip per name, sorts typed from handwritten, and sends typed strips here. For handwritten strips use passenger-list-handwriting-reader.
Use
from PIL import Image
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
proc = TrOCRProcessor.from_pretrained("horatio12/passenger-list-typed-reader")
model = VisionEncoderDecoderModel.from_pretrained("horatio12/passenger-list-typed-reader").eval()
pix = proc(images=Image.open("strip.png").convert("RGB"), return_tensors="pt").pixel_values
ids = model.generate(pix, max_new_tokens=48, interpolate_pos_encoding=pix.shape[-1] != pix.shape[-2])
print(proc.batch_decode(ids, skip_special_tokens=True)[0])
Results
On 9 typed pages from reels nothing was trained on, counting only names where two independent reads agree on the truth: 258 of 315 words right (81.9%), 101 full names right, 5.2% of letters wrong. The base model on the same pages, with the older strip cutter, got 70 words and 5 full names right.
Training labels
Each strip was read twice by Claude, and only names where both reads agreed were kept. They were not checked by a person.
Limits
Tuned for short name strips from these lists, not for general printed text. Untested on other ports, though US ports used the same federal forms from 1907 on. Strips that clip a first letter or hold two rows read badly.
License
MIT, following the TrOCR code. The base model's card states no license.
- Downloads last month
- 36
Model tree for horatio12/passenger-list-typed-reader
Base model
microsoft/trocr-base-printed