pytorch_beam_search icon indicating copy to clipboard operation
pytorch_beam_search copied to clipboard

Length Penalty with Beam Search

Open ra1995 opened this issue 1 year ago • 1 comments

Hi, great work on the beam search implementation. I was going through your code to understand your implementation and noticed that you a) Don't terminate a beam when the EOS token is predicted by the language model, b) There is no length penalty for the probabilities.

Am I right in noticing these or have I missed something? I would be glad if you could give me an idea about how I can implement these two features. Thank you.

ra1995 avatar Dec 11 '23 04:12 ra1995

Hi,

You are right, there features are not implemented. I am aware that they are part of Beam Search, but I didn't need them for my work back then.

For a), I made it this way in order to keep the functions vectorized. For b), I couldn't find a way to implement it.

If you find a way to extend my code, I would be very happy to include them via a pull request.

jarobyte91 avatar Dec 14 '23 19:12 jarobyte91