Fix resize_token_embeddings for Transformer-XL
Author: RafaelWO
Pull request: yes

Fixes #3554 

As discussed in the issue above, the fix ensures that per default the last layer of the `AdaptiveEmbedding` is resized. Otherwise the target layer can be passed to the `resize_token_embeddings()` method as the parameter `layer`.

After the resizing is done, the cutoffs are adjusted accordingly.

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

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

```diff
@@            Coverage Diff             @@
##           master    #4759      +/-   ##
==========================================
- Coverage   77.41%   77.35%   -0.06%     
==========================================
  Files         128      128              
  Lines       21059    21105      +46     
==========================================
+ Hits        16302    16325      +23     
- Misses       4757     4780      +23     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4759?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_transfo\_xl.py](https://codecov.io/gh/huggingface/transformers/pull/4759/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190cmFuc2ZvX3hsLnB5) | `78.65% <95.65%> (+1.69%)` | :arrow_up: |
| [src/transformers/data/processors/squad.py](https://codecov.io/gh/huggingface/transformers/pull/4759/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvc3F1YWQucHk=) | `28.66% <0.00%> (-6.37%)` | :arrow_down: |
| [src/transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4759/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25fdXRpbHMucHk=) | `89.80% <0.00%> (-0.12%)` | :arrow_down: |

------

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


Thanks!
Yes sure, I was already thinking that a test could be useful here. I will try my best and add a test in [test_modeling_transfo_xl.py](https://github.com/huggingface/transformers/blob/master/tests/test_modeling_transfo_xl.py), correct? Do I have to add a separate class for it or include it in [TransfoXLModelTester](https://github.com/huggingface/transformers/blob/2b8b6c929e282958a920ba2aa26ee59106986ec3/tests/test_modeling_transfo_xl.py#L42) ?

Is there any proper way to run/debug only one test so I can try out my test-code easily?

I was thinking of putting it in `TransfoXLModelTest` under the name `test_resize_tokens_embeddings` so that it overrides the parent class' method. Alongside the method `test_model_from_pretrained`, do you see what I mean?

You can run the test suite for only this file using the following command (requires `pytest` and `pytest-cov` installed, which gets you the best stacktrace):

```
python -m pytest -sv ./tests/*modeling_transfo* --cov       
```

Let me know if you need any help!

Ok I added a test for the new `resize_token_embeddings` method.

P.S. running `isort --recursive examples templates tests src utils` reformats the file `examples\benchmarking\plot_csv_file.py` for me. Should I add this change too or ignore it?

@LysandreJik I'm happy to contribute :)
I have another question: Since my implementation supports resizing embedding layers other than the first, the added tokens have to be moved in the tokenizer as well. I also have a solution for this which I added into the `TransfoXLTokenizer`. Should I open a separate issue and PR for this (or just PR) or add it here, as it's somehow related?

@patrickvonplaten, since you've worked a bit with TransformerXL in the past, do you want to take a look before we merge?

I like it - looks very clean to me!