Spaces:
Paused
Paused
Update app_chat.py
Browse files- app_chat.py +8 -4
app_chat.py
CHANGED
@@ -92,10 +92,14 @@ def generate(
|
|
92 |
t.start()
|
93 |
|
94 |
outputs = []
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
99 |
|
100 |
chat_interface = gr.ChatInterface(
|
101 |
fn=generate,
|
|
|
92 |
t.start()
|
93 |
|
94 |
outputs = []
|
95 |
+
try:
|
96 |
+
for text in streamer:
|
97 |
+
outputs.append(text)
|
98 |
+
yield "".join(outputs)
|
99 |
+
except:
|
100 |
+
print("restarting the model, got some error")
|
101 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="cuda", trust_remote_code=True)
|
102 |
+
model = model.cuda().to(torch.bfloat16)
|
103 |
|
104 |
chat_interface = gr.ChatInterface(
|
105 |
fn=generate,
|