Regression test for pegasus bugfix
Author: sshleifer
Pull request: yes

The bug was that tokenizer.max_model_length (set through `tokenizer_config.json`) was sometimes 1024, but `max_position_embeddings` was only 512.  This means that the tokenizer can produce inputs of length 513, which will produce an IndexError when we try to get the from the embedding table.

Since the position embeddings are static for pegasus, the fix was on s3: set the max_position_embeddings to the correct value, and remove the saved, incorrectly sized position embeddings from the state dict.

The tradeoff here is that users can now pass max_position_embeddings=HUGE to the model without error, and pass huge inputs, and either OOM or get shitty performance. But if you are modifying config you sort of know what you are doing so I'm OK with it.


This PR:
- suppresses the warning created by the S3 change
- adds a regression test that `config.max_position_embeddings >= tokenizer.max_model_length`


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/6606?src=pr&el=h1) Report
> Merging [#6606](https://codecov.io/gh/huggingface/transformers/pull/6606?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/18ca0e91402d17950b870d7c9f67ddb7fd573817?el=desc) will **decrease** coverage by `0.61%`.
> The diff coverage is `100.00%`.

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

```diff
@@            Coverage Diff             @@
##           master    #6606      +/-   ##
==========================================
- Coverage   79.89%   79.28%   -0.62%     
==========================================
  Files         156      156              
  Lines       28213    28215       +2     
==========================================
- Hits        22542    22370     -172     
- Misses       5671     5845     +174     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/6606?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/configuration\_pegasus.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX3BlZ2FzdXMucHk=) | `100.00% <100.00%> (+9.09%)` | :arrow_up: |
| [src/transformers/modeling\_pegasus.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19wZWdhc3VzLnB5) | `100.00% <100.00%> (ø)` | |
| [src/transformers/modeling\_tf\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl94bG5ldC5weQ==) | `21.12% <0.00%> (-71.05%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_flaubert.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9mbGF1YmVydC5weQ==) | `24.53% <0.00%> (-63.81%)` | :arrow_down: |
| [src/transformers/modeling\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19yb2JlcnRhLnB5) | `77.37% <0.00%> (-19.71%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `86.64% <0.00%> (-0.33%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `88.05% <0.00%> (+0.55%)` | :arrow_up: |
| [src/transformers/modeling\_t5.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190NS5weQ==) | `83.83% <0.00%> (+6.20%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9yb2JlcnRhLnB5) | `93.22% <0.00%> (+47.80%)` | :arrow_up: |
| [src/transformers/modeling\_tf\_electra.py](https://codecov.io/gh/huggingface/transformers/pull/6606/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9lbGVjdHJhLnB5) | `98.95% <0.00%> (+73.82%)` | :arrow_up: |

------

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


Just to get some context, why can't we fix the tokenizer's default value?

correct max_model_length differs between checkpoints


But isn't each tokenizer instantiated with a checkpoint?
I'd expect this to be automatically done by
```
tokenizer1 = AutoTokenizer.from_pretrained("checkpoint_with_one_max_len")
tokenizer2 = AutoTokenizer.from_pretrained("checkpoint_with_another_max_len")
```

Yeah. The tokenizer defaults have always been correct.

The issue was that fixing the model defaults to match them created an inconsistency with the state_dict on s3.

For cnn...

- Broken converter creates model, config with 512 positional embeddings.  Tokenizer is good -- says max_model_length=1024.
- User reports IndexError bug. #6599 
- Sam adjusts model config to position_embeddings=1024. 
- This creates a new error: at __init__ the cnn model will allocate space for 1024 positional embeddings, but the state dict on s3 will only have 512. #6909
- Sam deletes positional embeddings on S3. Code works but gives missing key warning.
- Sam sends this PR to suppress warning, add regression test that checks that #6599 can't happen again.