Modify beam search objective

Hi, I would like to experiment with adding an additional penalty term to the beam search objective used when calling generate(). What is the best way to go about this?

Hello! Have you find any solution? I found this post via Google searching the same question : D


You may find this blog post interesting:

It shows how to customize the beam search objective of Transformer-based methods.


Wow, that looks very helpful, thank you!