Refactor BartModel so that input checks are handled within enc/dec
Author: tomhosking
Pull request: yes

Implementing #3133 

I've left the code that creates dummy inputs and checks/filters the outputs, this could potentially also be moved to `BartEncoder` and `BartDecoder`.

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

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

```diff
@@            Coverage Diff             @@
##           master    #3137      +/-   ##
==========================================
+ Coverage   77.94%   77.95%   +0.01%     
==========================================
  Files          98       98              
  Lines       16561    16565       +4     
==========================================
+ Hits        12908    12913       +5     
+ Misses       3653     3652       -1
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3137?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_bart.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19iYXJ0LnB5) | `93.43% <100%> (+0.04%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_pytorch\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9weXRvcmNoX3V0aWxzLnB5) | `89.93% <0%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19yb2JlcnRhLnB5) | `95.71% <0%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ194bG5ldC5weQ==) | `75.77% <0%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_ctrl.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19jdHJsLnB5) | `98.22% <0%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19vcGVuYWkucHk=) | `81.54% <0%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3137/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `94.45% <0%> (+0.15%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/3137?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/3137?src=pr&el=footer). Last update [30624f7...31acb8d](https://codecov.io/gh/huggingface/transformers/pull/3137?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


have you checked whether this breaks `RUN_SLOW=1 pytest tests/test_modeling_bart.py`? There is some subtletly with caching+remaking the attention mask everytime.

Looks good I think?

```
========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /Users/tom/dev/transformers
plugins: xdist-1.31.0, forked-1.1.3
collected 30 items                                                                                                                                                       

tests/test_modeling_bart.py ...........s.................s                                                                                                         [100%]

============================================================================ warnings summary ============================================================================
.venv/lib/python3.7/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py:15
  /Users/tom/dev/transformers/.venv/lib/python3.7/site-packages/tensorflow_core/python/pywrap_tensorflow_internal.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

-- Docs: https://docs.pytest.org/en/latest/warnings.html
========================================================== 28 passed, 2 skipped, 1 warning in 393.65s (0:06:33) ==========================================================
```

Awesome, LGTM. Will wait for @thomwolf