Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,9 +26,11 @@ def chat(message: str, history: list, stm_state: torch.Tensor, temperature: floa
|
|
| 26 |
model.load_stm_state(stm_state)
|
| 27 |
|
| 28 |
response = ""
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
| 32 |
|
| 33 |
return history + [[message, response]], model.export_stm_state().cpu()
|
| 34 |
|
|
|
|
| 26 |
model.load_stm_state(stm_state)
|
| 27 |
|
| 28 |
response = ""
|
| 29 |
+
|
| 30 |
+
with torch.amp.autocast(device_type=device.type, dtype=torch.bfloat16):
|
| 31 |
+
for token_id in model.interact(**tokenized_query, max_seq_len=seq_len, temperature=temperature, top_p=top_p):
|
| 32 |
+
response += model.stringify_token(token_id, show_memory_update=True)
|
| 33 |
+
yield history + [[message, response]], stm_state
|
| 34 |
|
| 35 |
return history + [[message, response]], model.export_stm_state().cpu()
|
| 36 |
|