[WIP] Squad refactor
Author: LysandreJik
Pull request: yes

This PR aims to refactor SQuAD to make it usable with all models with question answering heads, and without having to build the entire tokenization pipeline as it is currently done.

- It is based on processors that manage data, similarly to the GLUE processors. The two new processors are `SquadV1Processor` and `SquadV2Processor`. They'll probably be merged into a single `SquadProcessor` as the difference between the two versions is minimal.
- It leverages powerful abstractions made for the `run_glue` refactor a few months ago that greatly simplified the tokenization pipeline
- It can be interfaced with the package `tensorflow_datasets`.
- It better respects the library-wide naming, with `attention_mask` instead of `input_mask` and `token_type_ids` instead of `segment_ids`, among others.
- Introduces padding to `encode` and `encode_plus`, alongside tests.

It is still a work on progress but some aspects of it are working.

### Left to do

- [x] Add the processors to `__init__.py`
- [x] Patch the evaluation so that it leverages the current interface
- [x] Patch the evaluation so that it may work with tfds
- [x] Modify the run arguments to reflect the changes
- [x] Remove the `only_first` argument which would only be used for testing
- [x] Update tests running the `run_squad.py` script
- [x] Include the padding location in the tokenizers and reflect the changes in the feature converter
- [x] Test that all current models can train and evaluate (BERT, RoBERTa, XLNet, XLM)
- [x] Add the last models (DistilBERT, ALBERT, ...)
- [x] Return datasets (maybe only pytorch TensorDataset for now)
- [x] Documentation
- [x] Short examples showcasing the simply usage in the processors section.
- [x] Patch the evaluation for impossible questions

### Running sample

Here's the major difference from the user's perspective. Initially, to obtain the examples which were then converted to features, the user had to do as follows (taken from the current `run_squad.py`), which only works for BERT/XLNet/DistilBERT/ALBERT:

```py

examples = read_squad_examples(
    input_file=input_file,
    is_training=not evaluate,
    version_2_with_negative=args.version_2_with_negative
)
     
features = convert_examples_to_features(
    examples=examples,
    tokenizer=tokenizer,
    max_seq_length=args.max_seq_length,
    doc_stride=args.doc_stride,
    max_query_length=args.max_query_length,
    is_training=not evaluate,
    cls_token_segment_id=2 if args.model_type in ['xlnet'] else 0,
    pad_token_segment_id=3 if args.model_type in ['xlnet'] else 0,
    cls_token_at_end=True if args.model_type in ['xlnet'] else False,
    sequence_a_is_doc=True if args.model_type in ['xlnet'] else False
)
```
In order to obtain the exact same results, the user now has to do as follows, which will be completely model independant once the `sequence_a_is_doc` is integrated in our sequence pair tokenization methods:

```py
processor = SquadV1Processor()
examples = processor.get_dev_examples("examples/squad") if evaluate else processor.get_train_examples("examples/squad")
features = squad_convert_examples_to_features(
    examples=examples,
    tokenizer=tokenizer,
    max_seq_length=args.max_seq_length,
    doc_stride=args.doc_stride,
    max_query_length=args.max_query_length,
    is_training=not evaluate,
    sequence_a_is_doc=True if args.model_type in ['xlnet'] else False
)
```

The same can be done by using TFDS instead, removing the need to specify a file. The two initial lines now become:

```py
tfds_examples = tensorflow_datasets.load("squad")["validation"] if evaluate else tensorflow_datasets.load("squad")["train"] 
examples = SquadV1Processor().get_examples_from_dataset(tfds_examples)
```


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

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

```diff
@@            Coverage Diff             @@
##           master    #1984      +/-   ##
==========================================
- Coverage   82.67%   79.56%   -3.12%     
==========================================
  Files         111      113       +2     
  Lines       16162    16969     +807     
==========================================
+ Hits        13362    13501     +139     
- Misses       2800     3468     +668
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/1984?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [transformers/data/metrics/squad\_metrics.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2RhdGEvbWV0cmljcy9zcXVhZF9tZXRyaWNzLnB5) | `0% <0%> (ø)` | |
| [transformers/tests/tokenization\_tests\_commons.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rlc3RzL3Rva2VuaXphdGlvbl90ZXN0c19jb21tb25zLnB5) | `100% <100%> (ø)` | :arrow_up: |
| [transformers/data/\_\_init\_\_.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2RhdGEvX19pbml0X18ucHk=) | `100% <100%> (ø)` | :arrow_up: |
| [transformers/tokenization\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rva2VuaXphdGlvbl94bG5ldC5weQ==) | `90.4% <100%> (+0.15%)` | :arrow_up: |
| [transformers/data/processors/\_\_init\_\_.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2RhdGEvcHJvY2Vzc29ycy9fX2luaXRfXy5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rva2VuaXphdGlvbl91dGlscy5weQ==) | `91.02% <100%> (+0.55%)` | :arrow_up: |
| [transformers/data/processors/squad.py](https://codecov.io/gh/huggingface/transformers/pull/1984/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2RhdGEvcHJvY2Vzc29ycy9zcXVhZC5weQ==) | `14.7% <14.7%> (ø)` | |

------

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


Should be about ready to merge now. ~I'm reproducing the results paper results on XLNet, BERT, XLM, RoBERTa, DistilBERT and ALBERT to make sure it works as expected, then I'll rebase and call for review.~

I made sure that I obtain somewhat the same results with fine-tuning + evaluating models with the old and new scripts. I could confirm it is the case for DistilBERT, BERT and XLNet.

Ok this is great, merging!

@LysandreJik do you want to have a quick look at the two comments I wrote about doc/docstring and the incomplete warning?

Merging now because these are small tweak and @mfuntowicz need this PR for his PR so I'll let you push a doc commit on master directly maybe.