IndexError: too many indices for tensor of dimension 1

Hello, tried to finetuning the translation model on a batch (in general, I would like to retrain it on a different dataset, but first I wanted to try this) I read the documentation and it seems like I wrote the same code, but I get the following error:
shifted_input_ids[:, 1:] = input_ids[:, :-1].clone()
IndexError: too many indices for tensor of dimension 1

Here is code:

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, AdamW


checkpoint = 'Helsinki-NLP/opus-mt-fr-en'
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)


sequences = ['médaillons de bœuf, poulet, pâte',
                       'beef medallions, chicken, paste']


batch = tokenizer(sequences, padding=True, return_tensors='pt')

batch['labels'] = torch.tensor([1, 1])

optimizer = AdamW(model.parameters())
loss = model(**batch).loss