I have been trying to fine-tune MarianMT for English to German on a custom dataset that  I have.  I want to fine-tune it using the native PyTorch approach in python. But when I try to load the dataset in PyTorch’s Dataloader and iterate over it to print a batch, I get the following error:  unsupported operand type(s) for +: ‘Tensor’ and ‘list’. I have attached the snap of the error that I got.

image1243×736 50.8 KB

I have followed the procedure of fine-tuning the model from https://huggingface.co/course/chapter3/4?fw=pt 1  making suitable changes according to the requirements of the model. Another reference that I have used from here: https://huggingface.co/transformers/notebooks.html 2
The error does not occur when I do not pass the DataCollatorForSeq2Seq in Dataloader.
Checkpoint used = Helsinki-NLP/opus-mt-en-de
Thank You!