[Whisper] Fix forced decoder ids
Author: sanchit-gandhi
Pull request: yes

# What does this PR do?

The Whisper tokenizer has a property `self.prefix_tokens` that returns the token ids appended to the start of label sequence:
```

 
 
 
 ...
```

In the PR https://github.com/huggingface/transformers/pull/20589, the method `get_decoder_prompt_ids` was copied from the Whisper processor to the Whisper tokenizer, where it then made use of the tokenizer property `self.prefix_tokens`. The method `get_decoder_prompt_ids` is used to set the tokens that are forced at the beginning of the generation process. 

However, the forced decoder ids **should not** contain the `
` token: this is the `decoder_start_token_id` that we use as token 0 when we start generation. If we include `
` in our forced decoder ids, we'll get a double generation of `
`. Thus, we only want to set the following tokens in the `forced_decoder_ids`:
```

 
 
 ...
```

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] 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 make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- 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:
_The documentation is not available anymore as the PR was closed or merged._

fyi @sgugger, the final fix we hope 🤞

Yes! Let me clarify! 

When training, we need to encode a sentence to a sequence of label ids. Here, we need to append the 'special' beginning of sentence tokens to the label ids. This is so that the model learns to predict the correct 'special' tokens for the generation process. For a full list of the tokens added, see this PR: https://github.com/huggingface/transformers/pull/19921

One of these tokens is the `
` token. This is consistent with other tokenisers in the library, such as the BART tokeniser:
```python
from transformers import BartTokenizer

tokenizer = BartTokenizer.from_pretrained("facebook/bart-base")
input_str = "the cat"
tokens = tokenizer(input_str).input_ids
print(tokenizer.decode(tokens))
```
**Print Output:**
```

the cat

```

Now, it doesn't matter for training whether or not we append the decoder start token id to the start of our label sequence, because we cut it in our data collator:

https://github.com/huggingface/transformers/blob/3ac040bca1efbf5cfe9604a5b2a10a5392917c20/examples/pytorch/speech-recognition/run_speech_recognition_seq2seq.py#L249

So, adding the decoder start token id is more for making the tokeniser user friendly and consistent with other tokenisers in the library.


@sanchit-gandhi Thanks. Just want to point out: For `bart`, yes, we have  bos `
` (id `0`). But it is not the **decoder** start token (which is `
` for bart, with id `2`) - it is just the start of the sentence (not ready for generation). The `labels`  has `bos` but not  `decoder_start_token`. The labels will be shifted and prepended with `
` to become decoder input ids.

In Whisper, I understand we want to be user-friendly. And as you have cut it in data collator, it is fine. But IMO, this is something a bit different from our NLP models (i.e. Bart here). Hopefully I understand it correctly.