Fix the loss calculation of ProphetNet
Author: StevenTang1998
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 #9804 


## Before submitting
- [ ] 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.
- [ ] Did you write any new necessary tests?


## Who can review?

@patrickvonplaten

<!-- 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: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- 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:
Thanks for the fix here @StevenTang1998 - did you succesfully run a ProphetNet fine-tuning with this fix? :-)

Yes, I have the very close results of my pr and that of the code to calculate loss manually.

That sounds great! 
I'm running the training command:

```
python examples/pytorch/summarization/run_summarization.py --learning_rate=3e-5  --do_train --do_eval --evaluation_strategy steps --model_name_or_path microsoft/prophetnet-large-uncased             --output_dir myoutputdir             --per_device_train_batch_size 8 --per_device_eval_batch_size 16             --eval_accumulation_steps 8 --gradient_accumulation_steps 8 --num_train_epochs=20   --load_best_model_at_end --save_steps 25 --logging_steps 25 --fp16             --overwrite_output_dir --dataset_name cnn_dailymail --dataset_config_name 3.0.0
```

on a single GPU once to verify that training works :-) Will let you know how it goes!

I've run training for 5h and the loss goes down nicely which is a very good sign! Maybe this is the long-awaited ProphetNet fix :partying_face: 

Merging!