Error: should have a 'get_encoder' function defined when running model.generate()
Author: toomtobias
Pull request: no

## 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: 3.4.0
- Platform: Windows-10-10.0.17134-SP0
- Python version: 3.8.4
- PyTorch version (GPU?): 1.5.1+cpu (False)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: don't know

### Who can help
<!-- 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.-->

@sshleifer

## Information

Model I am using (Bert, XLNet ...): facebook/bart-large-cnn

The problem arises when using:
* [X ] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [X ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1. Run the code below

<!-- 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.-->

```python
from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-cnn")

model = AutoModel.from_pretrained("facebook/bart-large-cnn")

ARTICLE_TO_SUMMARIZE = "My friends are cool but they eat too many carbs."

inputs = tokenizer([ARTICLE_TO_SUMMARIZE], max_length=1024, return_tensors='pt')

# Generate Summary
summary_ids = model.generate(inputs['input_ids'], num_beams=4, max_length=5, early_stopping=True)
```

Error i get:

>>> summary_ids = model.generate(inputs['input_ids'], num_beams=4, max_length=5, early_stopping=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\scbtoto\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\autograd\grad_mode.py", line 15, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\scbtoto\AppData\Local\Programs\Python\Python38\lib\site-packages\transformers\generation_utils.py", line 401, in generate
    assert hasattr(self, "get_encoder"), "{} should have a 'get_encoder' function defined".format(self)
AssertionError: BartModel(
  (shared): Embedding(50264, 1024, padding_idx=1)
  (encoder): BartEncoder(
    (embed_tokens): Embedding(50264, 1024, padding_idx=1)
    (embed_positions): LearnedPositionalEmbedding(1026, 1024, padding_idx=1)
    (layers): ModuleList(
      (0): EncoderLayer(
        (self_attn): Attention(
          (k_proj): Linear(in_features=1024, out_features=1024, bias=True)
          (v_proj): Linear(in_features=1024, out_features=1024, bias=True)
          (q_proj): Linear(in_features=1024, out_features=1024, bias=True)
          (out_proj): Linear(in_features=1024, out_features=1024, bias=True)
        )
...
...
...
  )
    (layernorm_embedding): LayerNorm((1024,), eps=1e-05, elementwise_affine=True)
  )
) should have a 'get_encoder' function defined
>>>

## Expected behavior

Im trying to run the basic example from the docs found here:
https://huggingface.co/transformers/model_doc/bart.html


i can run the code below without a problem so transformers should be prorperly installed according to the installations docs.

python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"




Comments:
Don't see that in the docs.
the docs use `BartForConditionalGeneration`.
You could also use `AutoModelForSeq2SeqLM`.
![image](https://user-images.githubusercontent.com/6045025/96788298-44463600-13c1-11eb-8191-e55089ab996f.png)