Good word list in generate function

Hi,

I know it’s possible to pass bad_words_ids to the generate function. I was wondering what is the best way to do the opposite. Giving the model a word list and force it to only use them.

Thanks

Setting the logits to +Inf for certain token, i.e. opposite to what is done in with bad_words_ids would result in a sequence that only contains that token(s) and, probably, make no sense as a sentence. Something like this feature request I submitted would allow a bit more flexibility. Feel free to react/comment to it. Also check this from the docs.