AttributeError: 'Model2Model' object has no attribute 'prepare_model_kwargs' in 2.5.1
Author: andr-ec
Pull request: no
Labels: name: wontfix

name: Core: Modeling

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...):
Model2Model

Language I am using the model on (English, Chinese ...):
English

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)
based on the quick start guide for Model2Model. 
if I create a model using any of the following, it get an exception during the forward call : 
```
model = Model2Model.from_pretrained('bert-base-uncased')


model = PreTrainedEncoderDecoder.from_pretrained('bert-base-uncased','bert-base-uncased')


decoder_config = BertConfig.from_pretrained('bert-base-uncased', is_decoder=True)
model = PreTrainedEncoderDecoder.from_pretrained('bert-base-uncased', 'bert-base-uncased', decoder_config=decoder_config)
```

```
model(torch.tensor([[10,20,300,4,500,600]]).cuda(), torch.tensor([[400,500]]).cuda(), decoder_lm_labels=torch.tensor([[400,500]]).cuda())[0]
```
this started happening in 2.5.1
2.5.0 didn't throw the error 

stacktrace: 
```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-77add3526cdd> in <module>()
----> 1 model(torch.tensor([[10,20,300,4,500,600]]).cuda(), torch.tensor([[400,500]]).cuda(), decoder_lm_labels=torch.tensor([[400,500]]).cuda())[0]

2 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
    530             result = self._slow_forward(*input, **kwargs)
    531         else:
--> 532             result = self.forward(*input, **kwargs)
    533         for hook in self._forward_hooks.values():
    534             hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/transformers/modeling_encoder_decoder.py in forward(self, encoder_input_ids, decoder_input_ids, **kwargs)
    221             kwargs: (`optional`) Remaining dictionary of keyword arguments.
    222         """
--> 223         kwargs_encoder, kwargs_decoder = self.prepare_model_kwargs(**kwargs)
    224 
    225         # Encode if needed (training, first prediction pass)

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in __getattr__(self, name)
    574                 return modules[name]
    575         raise AttributeError("'{}' object has no attribute '{}'".format(
--> 576             type(self).__name__, name))
    577 
    578     def __setattr__(self, name, value):

AttributeError: 'Model2Model' object has no attribute 'prepare_model_kwargs'
```
## Expected behavior

No error should occur.

## Environment info
<!-- You can run the command `python transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version: 2.5.1
- Platform: google colab
- Python version: 3.6
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:


Comments:
Looks like `PreTrainedEncoderDecoder.prepare_model_kwargs()` was removed in  #2745
Is there a reason for that? either `prepare_model_kwargs` should be added again or the line: 
`kwargs_encoder, kwargs_decoder = self.prepare_model_kwargs(**kwargs)`
should be removed from the forward call. I'd be happy to submit a PR with that guidance

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.