0

I am facing an issue with the donut repo. I am trying to load the pretrained model naver-clova-ix/donut-base-finetuned-cord-v2 but getting the same error every time:

Make sure _init_weights is implemented for <class 'donut.model.DonutModel'>

P.s: I have already tried by cloning the official branch of the repo via huggingface.co

Can anyone elaborate why this error is persisting or what could have gotten wrong in cloning the official branch? Suggestions will be appreciated

enter image description here

    model = DonutModel.from_pretrained("naver-clova-ix/donut-base-finetuned-cord-v2")
if torch.cuda.is_available():
    model.half()
    device = torch.device("cuda")
    model.to(device)
else:
    model.encoder.to(torch.bfloat16)
model.eval()
image = Image.open("train/images/0000ae6cbdb1.jpg").convert("RGB")
output = model.inference(image=image, prompt="<s_sroie-donut>")
output
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 30 '23 at 05:12

0 Answers0