MarianMTModel model.generate function issue after v4.30.2 
Author: bariscankurtkaya
Pull request: no

Hello there,

I have encountered a problem with the model.generate function after version v4.30.2 on several different systems. Below, you can find the problem description and the corresponding code block:

```
from transformers import AutoTokenizer, MarianMTModel

model_name = f"Helsinki-NLP/opus-tatoeba-en-tr"
model = MarianMTModel.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

text = 'Once upon a time I met a boy named Hugo Cabret he lived in a train station' # Just random sample text

print('Translating text ... ')
batch = tokenizer(text, return_tensors="pt",
                          padding=True, truncation=True)
print('batch:', batch)

generated_ids = model.generate(**batch, max_length=512)
print('generated_ids:', generated_ids)

translated = tokenizer.batch_decode(
            generated_ids, skip_special_tokens=True)
print('Translated text:',:', translated)
```

Output when I downgrade the transformers library to v4.30.2, which is correct.
```
Translating text ... 
batch: {'input_ids': tensor([[  895,  1100,    13,   144,     7,  1227,    13,   660,  3018, 15658,
         15952,    32,    15,    53,  2896,    21,    13,  2825,  2865,     0]]), 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])}
generated_ids: tensor([[59993,    95,  2491, 15658, 15952,  3433,  5240,    14, 12768, 45057,
             2,  8530, 25435, 13855,     2,     0]])

Translated text: ['Bir zamanlar Hugo Cabret adında bir çocukla tanışmıştım. Tren istasyonunda yaşıyordu.']
```

But unfortunately, when I upgraded the transformers library to the newest version v4.31.0, the model.generate function's return becomes corrupted.
```
Translating text ... 
batch: {'input_ids': tensor([[  895,  1100,    13,   144,     7,  1227,    13,   660,  3018, 15658,
         15952,    32,    15,    53,  2896,    21,    13,  2825,  2865,     0]]), 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])}
generated_ids: tensor([[59993,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
             2,     0]])
 Translated text: ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
```

As can be seen, the tokenizer works correctly, but unfortunately, the model.generate function returns corrupted data. By the way, I also tested the 'Helsinki-NLP/opus-mt-tc-big-en-tr' model, and it also generates corrupted data.

Despite that, the 'Helsinki-NLP/opus-mt-en-es' model generates correct results.

Comments:
Hi @bariscankurtkaya There is a problem in the weights of that model, I made a PR [here](https://huggingface.co/Helsinki-NLP/opus-tatoeba-en-tr/discussions/3) to fix them but it hasn't been merged. You can load the model weights of this PR by adding `revision="pr/3"` in your `from_pretrained` call.

> Hi @bariscankurtkaya There is a problem in the weights of that model, I made a PR [here](https://huggingface.co/Helsinki-NLP/opus-tatoeba-en-tr/discussions/3) to fix them but it hasn't been merged. You can load the model weights of this PR by adding `revision="pr/3"` in your `from_pretrained` call.

Thanks you are the best. 🚀 🤗