Error: The checkpoint you are trying to load has model type `got_ocr2`

#1
by temiwale88 - opened

Thanks for creating and forking this OCR model @yonigozlan .
I want to use it but I run into this error:

from transformers import AutoProcessor, AutoModelForImageTextToText
import torch

model_name = "yonigozlan/GOT-OCR-2.0-hf"

device = "cuda" if torch.cuda.is_available() else "cpu"

processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForImageTextToText.from_pretrained(
    model_name, low_cpu_mem_usage=True, device_map=device
)
model = model.eval().to(device)

>>> ValueError: The checkpoint you are trying to load has model type `got_ocr2` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.
You can update Transformers with the command `pip install --upgrade transformers`. If this does not work, and the checkpoint is very new, then there may not be a release version that supports this model yet. In this case, you can get the most up-to-date code by installing Transformers from source with the command `pip install git+https://github.com/huggingface/transformers.git`

I use pip install strategy but it doesn't work and same error occurs. Can you please help confirm the issue with the model type got_ocr2?

Thanks!

Yep that's normal, the model has not been merged yet! It should be merged today (in the main branch though, so you'll have to install Transformers from source :) ).

Awesome. Let me know when it's merged. Thank you for your hard work @yonigozlan !

Thanks @temiwale88 ๐Ÿค—, the model is now merged in main!

Thank you!

Thanks! Was just coming here to ask the same thing.

Sign up or log in to comment