YanshekWoo commited on
Commit
7e3a12b
1 Parent(s): 9bd55b7

update generate parameters

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -29,10 +29,14 @@ def chat_func(input_utterance: str, history: Optional[List[str]] = None):
29
  input_ids = tokenizer(history_str,
30
  return_tensors='pt',
31
  truncation=True,
32
- max_length=max_length).input_ids
 
 
 
33
 
34
  output_ids = model.generate(input_ids,
35
  max_new_tokens=30)[0]
 
36
  response = tokenizer.decode(output_ids, skip_special_tokens=True)
37
 
38
  history.append(response)
 
29
  input_ids = tokenizer(history_str,
30
  return_tensors='pt',
31
  truncation=True,
32
+ max_length=max_length,
33
+ top_p=0.95,
34
+ do_sample=True,
35
+ num_beams=4).input_ids
36
 
37
  output_ids = model.generate(input_ids,
38
  max_new_tokens=30)[0]
39
+
40
  response = tokenizer.decode(output_ids, skip_special_tokens=True)
41
 
42
  history.append(response)