Rbert - follow-up to #1301 - more robust configuration class loading
Author: thomwolf
Pull request: yes
Labels: name: wontfix

This PR update #1301 as discussed in the thread of #1308.

The configuration classes are updated to be more robust to the addition of new parameters (load defaults value first and then update with pretrained configuration if needed).

This incorporates the entity token ids directly in `BertConfig`.

cc @RichJackson

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/1421?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@ecc4f1b`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `97.95%`.

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

```diff
@@           Coverage Diff            @@
##             master   #1421   +/-   ##
========================================
  Coverage          ?   84.8%           
========================================
  Files             ?      84           
  Lines             ?   12711           
  Branches          ?       0           
========================================
  Hits              ?   10779           
  Misses            ?    1932           
  Partials          ?       0
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/1421?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [transformers/configuration\_distilbert.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25fZGlzdGlsYmVydC5weQ==) | `89.74% <100%> (ø)` | |
| [transformers/configuration\_bert.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25fYmVydC5weQ==) | `87.87% <100%> (ø)` | |
| [transformers/configuration\_gpt2.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25fZ3B0Mi5weQ==) | `88.63% <100%> (ø)` | |
| [transformers/tests/modeling\_roberta\_test.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rlc3RzL21vZGVsaW5nX3JvYmVydGFfdGVzdC5weQ==) | `82.14% <100%> (ø)` | |
| [transformers/tests/modeling\_bert\_test.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rlc3RzL21vZGVsaW5nX2JlcnRfdGVzdC5weQ==) | `96.73% <100%> (ø)` | |
| [transformers/configuration\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25fb3BlbmFpLnB5) | `89.13% <100%> (ø)` | |
| [transformers/configuration\_xlm.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25feGxtLnB5) | `93.33% <100%> (ø)` | |
| [transformers/modeling\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3JvYmVydGEucHk=) | `74.39% <92.3%> (ø)` | |
| [transformers/modeling\_bert.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX2JlcnQucHk=) | `88.92% <96.15%> (ø)` | |
| [transformers/configuration\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/1421/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25feGxuZXQucHk=) | `91.22% <96.42%> (ø)` | |

------

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


@thomwolf Is it possible to apply the changes on the TFxx classes as well?

hi @thomwolf anything I can do to help?

Thanks for the heads up. This one slipped out of my mind.
It's ready to merge I think (won't have time to do the TF conversion of the head).
Ok to merge @LysandreJik?

This actually needs deeper investigations to work with the new `input_embeds` inputs on master (skipping `input_ids`).

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.