Are there any higher version transformers compatible with transformers==3.0.2
### System Info

Hi. I am working code that only can run on Transformers==3.0.2, however there are other method which only can run on higher version. So I want to ask if there are higher version that is compatible with transformers==3.0.2 or with little revision? Many thanks!


### Who can help?

 @NielsRogge, @sgugger

### Information

- [ ] The official example scripts
- [X] My own modified scripts

Code of facebook research [FiD](https://github.com/facebookresearch/FiD)
### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)


NaturalQuestions | TriviaQA


### Reproduction

Run the [FiD code](https://github.com/facebookresearch/FiD) on a different version of transformers

### Expected behavior

Attribute error
Hey @CaffreyR! We would recommend you migrate your codebase from v3.0.2 to v4.x, which should then be compatible with all newer methods.

What is your problem when trying to upgrade?<|||||>Hi @LysandreJik , I run the [code](https://github.com/facebookresearch/FiD) in transformers 3.0.2, it works well. But in 4.21.3, it went wrong! Many thanks!
```
/tokenization_t5.py:220: UserWarning: This sequence already has </s>. In future versions this behavior may lead to duplicated eos tokens being added.
  f"This sequence already has {self.eos_token}. In future versions this behavior may lead to duplicated"
/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/transformers/models/t5/tokenization_t5.py:220: UserWarning: This sequence already has </s>. In future versions this behavior may lead to duplicated eos tokens being added.
  f"This sequence already has {self.eos_token}. In future versions this behavior may lead to duplicated"
Traceback (most recent call last):
  File "train_reader.py", line 212, in <module>
    checkpoint_path
  File "train_reader.py", line 55, in train
    labels=labels.cuda()
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/user/FiD/src/model.py", line 45, in forward
    **kwargs
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/transformers/models/t5/modeling_t5.py", line 1686, in forward
    encoder_last_hidden_state=encoder_outputs.last_hidden_state,
AttributeError: 'tuple' object has no attribute 'last_hidden_state'
```
![image](https://user-images.githubusercontent.com/84232793/188455124-87084a85-58c6-4fb9-9167-8302a25f3c8f.png)
<|||||>You can fix the code to make it work like this on the latest version:
```train_loss = model(input_ids=context_ids.cuda(), attention_mask=context_mask.cuda(), labels=labels.cuda(), return_dict=False )[0]```

As per the official docs, the forward method takes this argument which determines the format of the output:
>return_dict (bool, optional) — Whether or not to return a [ModelOutput](https://huggingface.co/docs/transformers/v4.21.3/en/main_classes/output#transformers.utils.ModelOutput) instead of a plain tuple.<|||||>Hi @saradhix , as we fixed this problems, a new problem occurred. Seems to be another version problem
```
Traceback (most recent call last):
  File "train_reader.py", line 213, in <module>
    checkpoint_path
  File "train_reader.py", line 71, in train
    dev_em = evaluate(model, eval_dataset, tokenizer, collator, opt)
  File "train_reader.py", line 114, in evaluate
    max_length=50
  File "/home/user/FiD/src/model.py", line 54, in generate
    max_length=max_length
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/transformers/generation_utils.py", line 1163, in generate
    inputs_tensor, model_input_name, model_kwargs = self._prepare_model_inputs(inputs, bos_token_id, model_kwargs)
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/transformers/generation_utils.py", line 412, in _prepare_model_inputs
    and self.encoder.main_input_name != self.main_input_name
  File "/home/user/anaconda3/envs/fid/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1208, in __getattr__
    type(self).__name__, name))
AttributeError: 'EncoderWrapper' object has no attribute 'main_input_name'
```

<img width="571" alt="image" src="https://user-images.githubusercontent.com/84232793/188636847-4d3b0b3d-538e-4d38-ba36-7b26a9fff938.png">

<|||||>The `main_input_name` attribute is something we introduced in a later version (in order to make the `generate` method work with text, vision and speech models, i.e. several modalities). It refers to the main input name of a model, like "input_ids" for text models, or "pixel_values" for vision models.

Each model defines this, see for instance [here](https://github.com/huggingface/transformers/blob/09178705101b9803e7b9ea7f79a46b4c242dd4bf/src/transformers/models/resnet/modeling_resnet.py#L252) for ResNet.<|||||>Hi @NielsRogge , so what should I do? Should I define it myself in the model?<|||||>Here's the PR that introduced it: https://github.com/huggingface/transformers/pull/14803

Yes, it's set to "input_ids" by default (and overwritten by vision and speech models)<|||||>Hi @NielsRogge @saradhix , it is very interesting that when I do this, it says warning. 
```
/home/user/anaconda3/envs/uw/lib/python3.7/site-packages/transformers/models/t5/tokenization_t5.py:174: FutureWarning: This tokenizer was incorrectly instantiated with a model max length of 512 which will be corrected in Transformers v5.
For now, this behavior is kept to avoid breaking backwards compatibility when padding/encoding with `truncation is True`.
- Be aware that you SHOULD NOT rely on t5-base automatically truncating your input to 512 when padding/encoding.
- If you want to encode/pad to sequences longer than 512 you can either instantiate this tokenizer with `model_max_length` or pass `max_length` when encoding/padding.
- To avoid this warning, please instantiate this tokenizer with `model_max_length` set to your preferred value.
  FutureWarning,
```

Is there any problem with this warning? Many thanks!!<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.<|||||>> Hi @NielsRogge , so what should I do? Should I define it myself in the model?
I meet the same problem. And I fixed it by adding main_input_name = "input_ids"
<img width="1199" alt="image" src="https://user-images.githubusercontent.com/74954034/236134400-01fd31cd-d156-4d41-865c-69dfd66b4425.png">
