run480 commited on
Commit
3b6e14c
·
verified ·
1 Parent(s): 0f5b3d1

Update app.py

Browse files

Lower the temperature

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -187,7 +187,9 @@ def generate(starting_text):
187
  # If the temperature is high, the model has a greater chance of outputting different words than those with the highest probability.
188
  # The generated text will feature a greater variety of topics, but there is also an increased likelihood that it will generate nonsense text and
189
  # contain grammatical errors.
190
- gpt2_tensors = mdl.generate(tkn_ids, max_length=100, no_repeat_ngram_size=True, num_beams=3, do_sample=True, temperature=1.5)
 
 
191
  response=""
192
  #response = gpt2_tensors
193
  for i, x in enumerate(gpt2_tensors):
 
187
  # If the temperature is high, the model has a greater chance of outputting different words than those with the highest probability.
188
  # The generated text will feature a greater variety of topics, but there is also an increased likelihood that it will generate nonsense text and
189
  # contain grammatical errors.
190
+
191
+ # With less temperature (1.5 --> 0.1), the output becomes less variational.
192
+ gpt2_tensors = mdl.generate(tkn_ids, max_length=100, no_repeat_ngram_size=True, num_beams=3, do_sample=True, temperature=0.1)
193
  response=""
194
  #response = gpt2_tensors
195
  for i, x in enumerate(gpt2_tensors):