Error fine tuning Donut model using LoRA

Hello,
I’m new to ML and this is probably a basic problem. I’m trying to fine tune Donut base model using my documents but getting errors.

The error is
TypeError: DonutSwinModel.forward() got an unexpected keyword argument ‘input_ids’

I’m generating a dataset using document images and annotations.jsonl with following data
{“label”: “{"load_id": "1234", "carrier_name": "Bison"}”, “image”: “TOUR_LOGISTICS_0.png”}

My dataset has
{
“pixel_values”: batch[“pixel_values”],
“decoder_input_ids”: batch[“decoder_input_ids”],
“labels”: batch[“labels”]
}
Isn’t Trainer process knows which field to use for Encoder and Decoder?

1 Like

It may be a version-dependent bug in Transoformers…

I downgraded to transformers==4.45.2 and it didn’t help.

1 Like

Hmm… Maybe the wrong collate_fn is assigned…
Or maybe the model settings are wrong.

https://stackoverflow.com/questions/77182311/question-about-data-collator-throwing-a-key-error-in-hugging-face

Isn’t Trainer process knows which field to use for Encoder and Decoder?

By default, it seems to be manual or fixed.