How to use microsoft/trocr-small-printed 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="microsoft/trocr-small-printed")
# Load model directly from transformers import AutoTokenizer, AutoModelForImageTextToText tokenizer = AutoTokenizer.from_pretrained("microsoft/trocr-small-printed") model = AutoModelForImageTextToText.from_pretrained("microsoft/trocr-small-printed")
Hi community! How I can convert this model to torchscript format?I tried something like this - https://huggingface.co/transformers/v3.1.0/serialization.html#saving-a-modelBut how I can inference this converted model?
Cc'ing @lewtun here
· Sign up or log in to comment