Hi @yusukemori
The _encode method does the same work as collate_fn.
The difference is that Seq2SeqTrainer also supports TPU and for that the padding needs to handled differently. It also prepares the correct labels and decoder_input_ids rather than doing this inside the trainer.
If you are using Seq2SeqTrainer , use Seq2SeqDataCollator.