Convert hans to Trainer
This follows up from #4854 (@julien-c I took all your comments into account) and will close #4742.
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/5025?src=pr&el=h1) Report
> Merging [#5025](https://codecov.io/gh/huggingface/transformers/pull/5025?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/1bf4098e03afaed2c6e3671c69fd57e9ac304752&el=desc) will **decrease** coverage by `0.09%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master    #5025      +/-   ##
==========================================
- Coverage   77.18%   77.09%   -0.10%     
==========================================
  Files         128      128              
  Lines       21877    21877              
==========================================
- Hits        16886    16866      -20     
- Misses       4991     5011      +20     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/5025?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/5025/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ194bG5ldC5weQ==) | `76.35% <0.00%> (-2.30%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5025/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `85.86% <0.00%> (-1.40%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5025/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `90.73% <0.00%> (+0.23%)` | :arrow_up: |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/5025/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.79% <0.00%> (+0.40%)` | :arrow_up: |

------

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