Hi PersiQ,
Thank you for your replay. I am sure my src lengths are longer than target lengths.  I tried using both reduction=“sum” and reduction=“mean”, but they both didn’t work.
My task is video based translation, maybe it is difficult to train with ctc loss.  My model is pretrained EfficientNet + self-attention + Linear layer, and then using CTCLoss. During training, after 1 epoch the ctc loss is approximately 5.5(the loss printed is divided by the tokens), and after 30 epochs, the ctc loss is still about 5.2. In addition, the model still only predicts blank.
Do you have experience in training similar models? I hope you can provide some suggestions.
Thank you.