-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPT2 text generation repeat #1725
Comments
Adding temperature (in brief, Temperature is a hyperparameter of LSTMs - and neural networks generally - used to control the randomness of predictions by scaling the logits before applying softmax) could be an interesting way! Here is a modified version of your code with temperature:
The output is the following:
Obviously, you can change seed and temperature itself too! |
@TheEdoardo93 Thanks for the feedback! Closing this issue. |
just have the same issue, anyone knows how to solve it? thx! |
@drizzt00s Since this posting, HF has put out a fantastic blog about generating text utilizing different sampling methods. I highly recommend it. It's well written! https://huggingface.co/blog/how-to-generate Give that a read and see if it helps you out. |
❓ Questions & Help
SYSTEM
OS: Linux pop-os 5.0.0
Python version: 3.6.8
Torch version: 1.3.0
Transformers version: 2.1.1
I am running this linux VM with the above software versions on a Windows 10 laptop.
I am running the following code:
What I was noticing was that GPT2 starts to produce repetitive text (see below) with this approach. I am not sure the best way to prevent this from happening and was wondering if others had any ideas? Thank you in advance!
OUTPUT
The text was updated successfully, but these errors were encountered: