Seq2seq-based model running slowly on TPU
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: v4.5.1 and newest version
- Platform: Colab
- Python version: 3.8
- PyTorch version (GPU?): 1.8.1
- TPU v2-8

### Who can help
@patil-suraj @patrickvonplaten
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik @sgugger
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @Rocketknight1

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

Model hub:

- for issues with a model report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

I tried to finetune mBART, T5, and MarianMTModel but all of them are running slowly on Colab TPUv2. I think the cause may come from Seq2seqTrainer since it works very well when I finetuned BERT on TPUv2 for MNLI Text classification.

The problem arises when using:
* The official example scripts: I use exactly the example parameter in README to train Translation model.
```
python xla_spawn.py --num_cores 8 \
    seq2seq/run_translation.py \
    --model_name_or_path Helsinki-NLP/opus-mt-en-ro \
    --do_train \
    --do_eval \
    --source_lang en \
    --target_lang ro \
    --dataset_name wmt16 \
    --dataset_config_name ro-en \
    --output_dir /tmp/tst-translation \
    --per_device_train_batch_size=4 \
    --per_device_eval_batch_size=4 \
    --overwrite_output_dir 
```

I provide my [Colab notebook](https://colab.research.google.com/drive/1Y8kSbuZJ8ChIjgAf67F1cSciVaHfGTyq?usp=sharing)

The tasks I am working on is:
* an official GLUE/SQUaD task: WMT16


<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior
Currently, with each step, the training duration increases many times. I want the duration is more stable and faster than GPU.
<!-- A clear and concise description of what you would expect to happen. -->

I'm not sure if we ever tested whether those seq2seq models run correctly on TPU (@patil-suraj). It might be the case that a lot of the computations are dynamic and therefore are constantly re-compiled.<|||||>I realize that I haven't passed --pad_to_max_length to the script, which leads to our model running slowly. So I will close this issue. Thank you for your support and sorry about that.<|||||>I have tested T5 and Marian on colab TPU and they work well

@heraclex12 you are right, on TPU we should always pass `--pad_to_max_length` to avoid XLA re-compilation, and ideally `max_length` should be multiple of 8.