Update run_xnli.py to use Datasets library
Author: Qbiwan
Pull request: yes

# What does this PR do?


<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes #9754


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [X] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [X] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@sgugger 

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @jplu

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- nlp datasets: [different repo](https://github.com/huggingface/nlp)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments:
Just tested the script locally and it seems to work great, congrats! We are almost done! The last part would be top adapt the end of the README in the text-classification folder to reflect how to use the new script (since the arguments are a bit different).

> Just tested the script locally and it seems to work great, congrats! We are almost done! The last part would be top adapt the end of the README in the text-classification folder to reflect how to use the new script (since the arguments are a bit different).

I've changed the script in README from
```
export XNLI_DIR=/path/to/XNLI

python run_xnli.py \
  --model_name_or_path bert-base-multilingual-cased \
  --language de \
  --train_language en \
  --do_train \
  --do_eval \
  --data_dir $XNLI_DIR \
  --per_device_train_batch_size 32 \
  --learning_rate 5e-5 \
  --num_train_epochs 2.0 \
  --max_seq_length 128 \
  --output_dir /tmp/debug_xnli/ \
  --save_steps -1
```
to 
```
python run_xnli.py \
  --model_name_or_path bert-base-multilingual-cased \
  --language de \
  --train_language en \
  --do_train \
  --do_eval \
  --per_device_train_batch_size 32 \
  --learning_rate 5e-5 \
  --num_train_epochs 2.0 \
  --max_seq_length 128 \
  --output_dir /tmp/debug_xnli/ \
  --save_steps -1
```

I've also removed these sentences below from [Fine-tuning on XNLI](https://github.com/huggingface/transformers/blob/master/examples/text-classification/README.md#fine-tuning-on-xnli)
```
The data for XNLI can be downloaded with the following links and should be both saved (and un-zipped) in a $XNLI_DIR directory.

    XNLI 1.0
    XNLI-MT 1.0
```

> This is in good shape to be merged, thanks a lot for your work! I just have a few comments on how to simplify things here and there since there is only one task to deal with in the new script.
> 
> One question I have is, is the tokenizer the same for the training and evaluation datasets, even if the languages, can be different?

I'm puzzled. Is `Trainer()` class doing the magic under the hood when the languages are different? or is it `AutoTokenizer.from_pretrained`?


I missed this is a multinlingual checkpoint, so there is no need for different tokenizers.

@patil-suraj it's good to merge IMO, I'll let you review one last time and merge if you approve.

 @sgugger Yay :)
@patil-suraj let me know if there's anything you would like me to change further


Thanks @sgugger @patil-suraj  for your helpful comments and guidance. I was jumping in at the deep end when I attempted this PR to be honest, but yay it's merged 😀

Great job adding this example and thanks a lot for your PR! Don't hesitate to brag a little bit on Twitter about your contribution ;-)