Spaces:
Runtime error
Runtime error
YanshekWoo
commited on
Commit
•
287e49e
1
Parent(s):
1a934e9
update generate parameters
Browse files
app.py
CHANGED
@@ -34,12 +34,14 @@ def chat_func(input_utterance: str, history: Optional[List[str]] = None):
|
|
34 |
return_tensors='pt',
|
35 |
truncation=True,
|
36 |
max_length=max_length,
|
37 |
-
|
38 |
-
do_sample=True,
|
39 |
-
num_beams=4).input_ids
|
40 |
|
41 |
output_ids = model.generate(input_ids,
|
42 |
-
max_new_tokens=30
|
|
|
|
|
|
|
|
|
43 |
response = tokenizer.decode(output_ids, skip_special_tokens=True)
|
44 |
|
45 |
history.append(response)
|
|
|
34 |
return_tensors='pt',
|
35 |
truncation=True,
|
36 |
max_length=max_length,
|
37 |
+
).input_ids
|
|
|
|
|
38 |
|
39 |
output_ids = model.generate(input_ids,
|
40 |
+
max_new_tokens=30,
|
41 |
+
top_p=0.95,
|
42 |
+
do_sample=True,
|
43 |
+
num_beams=4)[0]
|
44 |
+
|
45 |
response = tokenizer.decode(output_ids, skip_special_tokens=True)
|
46 |
|
47 |
history.append(response)
|