GPT2 generations with specific words
# ❓ Questions & Help

<!-- The GitHub issue tracker is primarly intended for bugs, feature requests,
     new models and benchmarks, and migration questions. For all other questions,
     we direct you to Stack Overflow (SO) where a whole community of PyTorch and
     Tensorflow enthusiast can help you out. Make sure to tag your question with the
     right deep learning framework as well as the huggingface-transformers tag: 
     https://stackoverflow.com/questions/tagged/huggingface-transformers 
     
     If your question wasn't answered after a period of time on Stack Overflow, you
     can always open a question on GitHub. You should then link to the SO question 
     that you posted.
     -->

## Details
@patrickvonplaten 
Just curious to generate a text with the specified words.
Generate function has a parameter bad_words, instead of removing these, I want to include these in generations. I try to edit in src/transformers/modeling_utils.py line 1194; to 
next_token_logits[batch_idx, banned_tokens[batch_idx]] = -float("inf")
changed to :
next_token_logits[batch_idx, banned_tokens[batch_idx]] = 1
 But this didn't work. Is there is any way we can do this?







These `next_token_logits[batch_idx, banned_tokens[batch_idx]]` are logits in the `range(-inf, inf)` not probabilities. You can try to set all other logits except your banned_tokens to `-float("inf")`