Fix streaming
Browse files
app.py
CHANGED
@@ -39,19 +39,17 @@ def generate_text(prompt):
|
|
39 |
output_ids = []
|
40 |
streamer_output = ""
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
output_scores=False
|
49 |
).sequences[0]:
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
yield partial_output
|
55 |
|
56 |
|
57 |
# Model options
|
|
|
39 |
output_ids = []
|
40 |
streamer_output = ""
|
41 |
|
42 |
+
for token_id in current_model.generate(
|
43 |
+
**inputs,
|
44 |
+
max_new_tokens=256,
|
45 |
+
do_sample=False,
|
46 |
+
return_dict_in_generate=True,
|
47 |
+
output_scores=False
|
|
|
48 |
).sequences[0]:
|
49 |
+
|
50 |
+
output_ids.append(token_id.item())
|
51 |
|
52 |
+
yield current_tokenizer.decode(output_ids, skip_special_tokens=True)
|
|
|
53 |
|
54 |
|
55 |
# Model options
|