Dataset and DataCollator for BERT Next Sentence Prediction (NSP) task
Add `DataCollatorForNextSencencePrediction` and `TextDatasetForNextSencencePrediction` to support mlm and next sentence prediction objectives together.
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/6644?src=pr&el=h1) Report
> Merging [#6644](https://codecov.io/gh/huggingface/transformers/pull/6644?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/41aa2b4ef1b9c2d14d5b06af2e0faa10592779dd?el=desc) will **decrease** coverage by `0.27%`.
> The diff coverage is `12.40%`.

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

```diff
@@            Coverage Diff             @@
##           master    #6644      +/-   ##
==========================================
- Coverage   79.64%   79.36%   -0.28%     
==========================================
  Files         157      156       -1     
  Lines       28564    28384     -180     
==========================================
- Hits        22750    22528     -222     
- Misses       5814     5856      +42     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/6644?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/\_\_init\_\_.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9fX2luaXRfXy5weQ==) | `99.28% <ø> (ø)` | |
| [...rc/transformers/data/datasets/language\_modeling.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL2RhdGFzZXRzL2xhbmd1YWdlX21vZGVsaW5nLnB5) | `56.97% <10.81%> (-34.86%)` | :arrow_down: |
| [src/transformers/data/data\_collator.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL2RhdGFfY29sbGF0b3IucHk=) | `57.14% <12.12%> (-32.57%)` | :arrow_down: |
| [src/transformers/data/datasets/\_\_init\_\_.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL2RhdGFzZXRzL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | |
| [src/transformers/tokenization\_marian.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25fbWFyaWFuLnB5) | `66.66% <0.00%> (-32.50%)` | :arrow_down: |
| [src/transformers/tokenization\_reformer.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25fcmVmb3JtZXIucHk=) | `81.66% <0.00%> (-13.34%)` | :arrow_down: |
| [src/transformers/tokenization\_xlm\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90b2tlbml6YXRpb25feGxtX3JvYmVydGEucHk=) | `84.52% <0.00%> (-10.72%)` | :arrow_down: |
| [src/transformers/benchmark/benchmark\_tf.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9iZW5jaG1hcmsvYmVuY2htYXJrX3RmLnB5) | `65.03% <0.00%> (-0.49%)` | :arrow_down: |
| [src/transformers/training\_args.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy90cmFpbmluZ19hcmdzLnB5) | `91.26% <0.00%> (-0.41%)` | :arrow_down: |
| [src/transformers/benchmark/benchmark.py](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9iZW5jaG1hcmsvYmVuY2htYXJrLnB5) | `81.88% <0.00%> (-0.29%)` | :arrow_down: |
| ... and [133 more](https://codecov.io/gh/huggingface/transformers/pull/6644/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/6644?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/6644?src=pr&el=footer). Last update [41aa2b4...ec89daf](https://codecov.io/gh/huggingface/transformers/pull/6644?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
<|||||>Hey so I have a PR out for the same task: https://github.com/huggingface/transformers/pull/6376

I'm mostly just writing this comment so that I can keep track of what the reviewers have to say and what happens with the NSP task.<|||||>Hi, @sgugger ! I add dict inputs support like `DataCollatorForLanguageModeling` according to your suggestion, but now there is a  conflict in `src/transformers/__init__.py`. Do I need to resolve it or leave it to you?<|||||>I can take care of the final merge once this is all good and @LysandreJik approved, it's due to a new version of isort.<|||||>Could we add a test for this? I just merged `master` in to make sure it has the latest changes.<|||||>After @LysandreJik merge the `master` branch, many files need to be reformatted. 
To clearly show the codes I modified, I did not include the changes caused by `make style` of other files in those commits, so `check_code_quality` will not pass.