The loss function should ignore tokens whose index is set to - 100
Loss function in `EncoderDecoderModel` as well as `BartForConditionalGeneration` didn't ignore special tokens:
https://github.com/huggingface/transformers/blob/e9800122a6f6a68aee7dff347c8f4a6d28e345a2/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py#L529

Does it need to be like the loss function in `T5ForConditionalGeneration`:
https://github.com/huggingface/transformers/blob/e9800122a6f6a68aee7dff347c8f4a6d28e345a2/src/transformers/models/t5/modeling_t5.py#L1644
No, the ignore_index is set to -100 by default as can be seen in PyTorch' [docs](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html).<|||||>> No, the ignore_index is set to -100 by default as can be seen in PyTorch' [docs](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html).

I got it, thank you very much!