AdamF92 commited on
Commit
f49fde3
·
verified ·
1 Parent(s): 79c163c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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
- for token_id in model.interact(**tokenized_query, max_seq_len=seq_len, temperature=temperature, top_p=top_p):
30
- response += model.stringify_token(token_id, show_memory_update=True)
31
- yield history + [[message, response]], stm_state
 
 
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