use autocast
Browse files
app.py
CHANGED
@@ -63,18 +63,18 @@ def generate(
|
|
63 |
thread = Thread(target=current_model.generate, kwargs=generate_kwargs)
|
64 |
thread.start()
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
return output
|
79 |
|
80 |
additional_inputs=[
|
|
|
63 |
thread = Thread(target=current_model.generate, kwargs=generate_kwargs)
|
64 |
thread.start()
|
65 |
|
66 |
+
# Write the prompt in blue
|
67 |
+
output = "<span style='color: blue;'>" + prompt + "</span>"
|
68 |
+
for new_text in streamer:
|
69 |
+
if isinstance(new_text, torch.Tensor):
|
70 |
+
new_text = current_tokenizer.decode(new_text)
|
71 |
+
if streamer.stop_signal in new_text:
|
72 |
+
output += new_text.split(streamer.stop_signal)[0]
|
73 |
+
break
|
74 |
+
output += new_text
|
75 |
+
yield output
|
76 |
+
|
77 |
+
thread.join()
|
78 |
return output
|
79 |
|
80 |
additional_inputs=[
|