Adding the prepare_seq2seq_batch function to ProphetNet
Author: forest1988
Pull request: yes

# What does this PR do?

I tried to use ProphetNet with Seq2SeqTrainer, but it failed.
The error message told me: this is because the collator uses `prepare_seq2seq_batch()` in `_encode()`, but `prepare_seq2seq_batch()` is not implemented in ProphetNet Tokenizer.

I've gotten kind advices in the HuggingFace forum, and implemented the function.

https://discuss.huggingface.co/t/the-reason-prepare-seq2seq-batch-for-prophetnet-is-not-existed/1758

The modifications are as below:
- Add `prepare_seq2seq_batch()` in `/src/transformers/tokenization_prophetnet.py`.
- To use .view in loss computation in Seq2SeqTrainer, I add a part where it is confirmed that logits is contiguous in `/src/transformers/modeling_prophetnet.py`.

I've checked it works on CPU and GPU as below:

```
!python finetune_trainer.py \
    --learning_rate=3e-5 \
    --do_train --do_eval --evaluate_during_training \
    --max_source_length 511 \
    --per_device_train_batch_size 2 \
    --predict_with_generate \
    --n_train 300 \
    --n_val 100 \
    --model_name_or_path microsoft/prophetnet-large-uncased \
    --data_dir $XSUM_DIR \
    --output_dir tmp_gpu \
    --overwrite_output_dir
```

Although the `PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES` is 512,  If `--max_source_lenght` is set to 512, `CUDA error` occurs. 
I'm sorry, but I have not been able to identify the cause of this.


## 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 the it if that's the case.
https://discuss.huggingface.co/t/the-reason-prepare-seq2seq-batch-for-prophetnet-is-not-existed/1758
- [ ] 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).
- [x] Did you write any new necessary tests?
https://github.com/forest1988/colaboratory/blob/main/prophetnet_seq2seqtrainer.ipynb
I'm sorry, I misunderstood what is being asked here.  Now I understood that the `./tests/`  code is needed.
~~I'm working on this, but I'm getting errors in formatting etc. and using `black` won't fix it.~~
I added related content to the `test_tokenization_prophetnet.py`. I changed the environment and made it work again according to the instructions, and it seems that formatting with `black` works appropriately. 

## Who can review?

@patrickvonplaten 
@sshleifer 

Thank you for kindly answering my questions in the forum!

Comments:
For fixing the check_code_quality failure, I run `make style` in the repository, but it tries to re-format so many files.
Should I check some settings for `black`?

I changed the environment and made it work again according to the instructions, and it seems that formatting with black works appropriately. Sorry for the bother you.

@patrickvonplaten 
Thank you for reviewing and merging the PR! I'm so happy to read your comment.

I haven't tried using the full dataset for fine-tuning ProphetNet with the seq2seq trainer, but I think I can try it by adding some modifications to my test code used during my implementation process.
I will try it and would like to post the results on the URL if I can get something interesting!


@patrickvonplaten 
I've just posted my fine-tuning experiment result on https://discuss.huggingface.co/t/how-can-i-do-text-summarization-using-prophetnet/1661/2.

I'm sorry it is not the case of using the full dataset.
Considering the time limitations of the execution environment, I used only about one-tenth of the dataset for now, but I think we could get better results if we used the entire dataset.

That's already of great help - thank you so much!

It's my pleasure!