What kind of model are you using? The criterion expects a tensor of probabilities (x batch size). So it seems like you do not have a final classifier layer at the top or that you pass the arguments incorrectly.
EDIT: I was wrong. We are talking about T5 which sees every problem as text-to-text.