Big cleanup of `glue_convert_examples_to_features`
Author: julien-c
Pull request: yes


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/3688?src=pr&el=h1) Report
> Merging [#3688](https://codecov.io/gh/huggingface/transformers/pull/3688?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/715aa5b1356b878cbab7a7415a1c1b03a7777ae2&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `10.63%`.

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

```diff
@@            Coverage Diff             @@
##           master    #3688      +/-   ##
==========================================
+ Coverage   78.02%   78.06%   +0.03%     
==========================================
  Files         104      104              
  Lines       17710    17708       -2     
==========================================
+ Hits        13819    13823       +4     
+ Misses       3891     3885       -6     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/3688?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/data/processors/utils.py](https://codecov.io/gh/huggingface/transformers/pull/3688/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvdXRpbHMucHk=) | `24.68% <0.00%> (ø)` | |
| [src/transformers/data/processors/glue.py](https://codecov.io/gh/huggingface/transformers/pull/3688/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvZ2x1ZS5weQ==) | `29.79% <10.86%> (+2.26%)` | :arrow_up: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/3688/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `91.84% <0.00%> (-0.13%)` | :arrow_down: |

------

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


There is a combinatorial explosion between `tokenizer classes` x `glue datasets` so it's not super practical to test everything, but:
- I've tested "roberta-large", "bert-base-uncased", "xlnet-based" tokenizers x "sst2" and "mnli" datasets and results are identical ✅ 
- encoding a batch of sentences or sentence pairs, while padding to a specific length, is really a native feature of a tokenizer at this point, so [those lines](https://github.com/huggingface/transformers/pull/3688/files#diff-8bc8284670454c05520b097dd51ad787R137-R139) in the current PR call the canonical API to do that. If there's a discrepancy with the historical way of tokenizing at this point it's probably outside the scope of this PR.


**Note, however**, that following this PR the performance boost associated with using a fast tokenizer coupled with using `batch_encode` seems very variable, cc: @n1t0 @mfuntowicz 

On my (mac OS) local machine it takes pretty much the same time using a fast and a non-fast tokenizer (even though the fast one burns all my CPU cores).

On a Colab notebook seems like perf varies a lot between executions (https://colab.research.google.com/drive/1DXOegSz7Tyr7MeSHYBBg40kiDhu4-JPr?authuser=1#scrollTo=NlygQfeyg-5b), with the fast tokenizer not always being faster than the other one.

See [notebook](https://colab.research.google.com/drive/1DXOegSz7Tyr7MeSHYBBg40kiDhu4-JPr)

Would be interesting to dive in and do a more systematic benchmark than I did, considering that GLUE is a good benchmark for a real-world training workload.