dennis-fast commited on
Commit
d1c541a
1 Parent(s): 3762b1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -15,8 +15,15 @@ def predict(input, history=[]):
15
  bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
16
 
17
  # generate a response
18
- history = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id).tolist()
19
-
 
 
 
 
 
 
 
20
  # convert the tokens to text, and then split the responses into lines
21
  response = tokenizer.decode(history[0]).split("<|endoftext|>")
22
  response = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)] # convert to tuples of list
 
15
  bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
16
 
17
  # generate a response
18
+ history = model.generate(
19
+ bot_input_ids,
20
+ max_length=1000,
21
+ pad_token_id=tokenizer.eos_token_id,
22
+ no_repeat_ngram_size=3,
23
+ top_p = 0.92,
24
+ top_k = 50
25
+ ).tolist()
26
+
27
  # convert the tokens to text, and then split the responses into lines
28
  response = tokenizer.decode(history[0]).split("<|endoftext|>")
29
  response = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)] # convert to tuples of list