Getting CrossEntropy loss from beam search scores

Hi all,

I’m trying to compute the cross entropy loss from the beam search output, there is any way I could use the outputs from BeamSearchEncoderDecoderOutput to compute the Cross entropy?

Moreover, I’m generating these sentences with a logit processor that puts invalid tokens to -inf during generation, that’s why I can’t use the forward method.

Thanks in advance!