Add slow generate tests for pretrained lm models
Move implementation of slow hardcoded generate models to this PR from. Checkout previous discussion in PR #2885 
> Please incorporate my comments on this file in the other PR :)

is on my radar :-) <|||||>UPDATE: Changed slow tests for language generation design according to discussion in PR #2885 .
If this looks alright, I'll add test cases for the other LMModels @LysandreJik & @sshleifer <|||||># [Codecov](https://codecov.io/gh/huggingface/transformers/pull/2909?src=pr&el=h1) Report
> Merging [#2909](https://codecov.io/gh/huggingface/transformers/pull/2909?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/38f5fe9e0277df67a01db80a1c640ac072a2381e?src=pr&el=desc) will **decrease** coverage by `1.03%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master    #2909      +/-   ##
==========================================
- Coverage   77.16%   76.12%   -1.04%     
==========================================
  Files          98       98              
  Lines       15997    15997              
==========================================
- Hits        12344    12178     -166     
- Misses       3653     3819     +166
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/2909?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_xlm.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ194bG0ucHk=) | `88.43% <100%> (ø)` | :arrow_up: |
| [src/transformers/modeling\_tf\_pytorch\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl9weXRvcmNoX3V0aWxzLnB5) | `8.72% <0%> (-81.21%)` | :arrow_down: |
| [src/transformers/modeling\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19yb2JlcnRhLnB5) | `85.71% <0%> (-10%)` | :arrow_down: |
| [src/transformers/modeling\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ194bG5ldC5weQ==) | `73.48% <0%> (-2.3%)` | :arrow_down: |
| [src/transformers/modeling\_ctrl.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19jdHJsLnB5) | `96.03% <0%> (-2.21%)` | :arrow_down: |
| [src/transformers/modeling\_openai.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19vcGVuYWkucHk=) | `80.2% <0%> (-1.35%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/2909/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `92.2% <0%> (-0.17%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/2909?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/2909?src=pr&el=footer). Last update [38f5fe9...0c5bdef](https://codecov.io/gh/huggingface/transformers/pull/2909?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
<|||||>Updated the language model generation slow tests following Roberta's and Bart's Integration Test style. What do you think? @LysandreJik  @sshleifer <|||||>Finished to add hard-coded tests for all models with LMHead: `GPT2, OpenAI, XLNet, TransfoXL, CTRL and XLM.`

All pretrained models generate reasonable results **except** `XLM`. Might need to take a closer look in a future PR.

Also future PRs TODO:

- [ ] Add hardcoded tests for seq-to-seq language generation
- [ ] Add hardcoded tests for DoubleHead language generation<|||||>Don't feel strongly, but I would consider deleting the XLM example so that the tests don't enforce bad generations.
Also, if it is possible to make shorter examples (or more than one token per line), it would make the code more readable.
Overall, I love this. Makes me feel a lot safer editing generation code!<|||||>We could also add a sentence to `Contributing.md` telling people who change the generation code which command to run to make sure they didn't break stuff
