[AutoModel] Split AutoModelWithLMHead into clm, mlm, encoder-decoder
Author: patrickvonplaten
Pull request: yes

This is a follow-up PR of #4874.

In #4874, `BertModelForMaskedLM` , was split into a clm `BertLMHeadModel` and mlm Bert Model `BertForMaskedLM`. In order for the encoder-decoder framework to work correctly, the `BertLMHeadModel` needs to be loaded, when instantiating an `EncoderDecoder.from_encoder_decoder_pretrained()`, therefore a new `AutoModelForCausalLM` has to be created.

This PR deprecates `AutoModelWithLMHead` and introduces:
- `AutoModelForCausalLM` for Autoregressive models
- `AutoModelForMaskedLM` for Autoencoding models
- `AutoModelForSeq2SeqCausalLM` for Sequence-to-sequence models with causal LM for the decoder

@julien-c @LysandreJik @sgugger @thomwolf @sshleifer -> `AutoModelWithLMHead` still works as before so no breaking changes, but it's deprecated. All AutoModels are exposed in the `__init__` (don't really see a reason why they shouldn't). What do you guys think about the naming?

**IMPORTANT:**
#4874 and this PR might introduce some breaking changes for the encoder-decoder framework:
Instead of using `AutoModelWithLMHead` one has to use `AutoModelForCausalLM` for the decoder model now and instead of using `BertForMaskedLM` one should use `BertLMHeadModel` from now one. 
There are **no breaking changes** for the encoder-decoder user-facing functions `.from_pretrained()` and `.from_encoder_decoder_pretrained()` 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=h1) Report
> Merging [#4933](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/e80d6c689bd62f805a5c8d77ec0cc3b09f240d14&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `60.00%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/4933/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #4933      +/-   ##
==========================================
+ Coverage   77.10%   77.11%   +0.01%     
==========================================
  Files         128      128              
  Lines       21723    21769      +46     
==========================================
+ Hits        16749    16788      +39     
- Misses       4974     4981       +7     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/\_\_init\_\_.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9fX2luaXRfXy5weQ==) | `99.13% <ø> (ø)` | |
| [src/transformers/modeling\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19hdXRvLnB5) | `70.58% <55.55%> (-7.82%)` | :arrow_down: |
| [src/transformers/modeling\_bert.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19iZXJ0LnB5) | `88.21% <100.00%> (+0.02%)` | :arrow_up: |
| [src/transformers/modeling\_encoder\_decoder.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19lbmNvZGVyX2RlY29kZXIucHk=) | `92.20% <100.00%> (ø)` | |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.79% <0.00%> (ø)` | |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `90.61% <0.00%> (+0.11%)` | :arrow_up: |
| [src/transformers/trainer.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90cmFpbmVyLnB5) | `39.48% <0.00%> (+0.23%)` | :arrow_up: |
| [src/transformers/modeling\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/4933/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ194bG5ldC5weQ==) | `78.65% <0.00%> (+2.29%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=footer). Last update [e80d6c6...7117cb1](https://codecov.io/gh/huggingface/transformers/pull/4933?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


This all looks good to me. I'd just simplify `AutoModelForSeq2SeqCausalLM` to `AutoModelForSeq2SeqLM` and the related names since I don't think there exists an encoder/decoder setup for LM where the decoder doesn't have a causal mask, so causal doesn't really add any needed info to the name.

I like this but if we merge this, I think we should make a note to actually remove the `AutoModelWithLMHead` at the next (or next-next?) major release otherwise users will still use it and it will be confusing

Merging to unblock the encoder decoder framework to work correctly. Pinging @thomwolf for notification.

Yes, I'm happy with this!

what is the different when i pass a ones.tril() mask to the bertencoder