# Fine-tuning T5 for translation

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tuning-t5-for-translation%2F11518%3E%5C
**Category:** Beginners\
**Created:** [November 9, 2021, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tuning-t5-for-translation%2F11518 "2021-11-09T17:37:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SnailTheSnail](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@SnailTheSnail](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSnailTheSnail)%5C
**Post date:** [November 9, 2021, 5:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tuning-t5-for-translation%2F11518%2F1 "2021-11-09T17:37:43Z")

</div>

Hi, I am trying to fine-tune T5 model for translation, however it seems that even though the pairs of sentences look ok after being tokenized there is something wrong with it and I am getting

> AssertionError: You should supply an encoding or a list of encodings to this method.

My dataset is pairs of english and french strings like:  
“translate English to French: Is this realistic?” , “Est-ce réaliste?”

This is my code:

```auto
dataset = pd.read_excel('en-fr.xlsx')
checkpoint = 't5-base'

#tokenizer
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
inputs = tokenizer(list(dataset['eng']), list(dataset['fr']), padding='longest', truncation=True, return_tensors='pt')
data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

#model
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)

#arguments
training_args = TrainingArguments('trainer_args')

#trainer
trainer = Trainer(model=model, args=training_args, train_dataset=inputs, data_collator=data_collator)
trainer.train()

```

Thank you in advance for any advice.
