Ruurd commited on
Commit
57ea763
·
1 Parent(s): ecbb7be

Break on "User:"

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -92,6 +92,9 @@ def chat_with_model(messages):
92
  streamer.end_of_generation.set() # signal to stop generation thread
93
  break
94
 
 
 
 
95
  if "<think>" in token_str:
96
  in_think = True
97
  token_str = token_str.replace("<think>", "")
@@ -118,6 +121,8 @@ def chat_with_model(messages):
118
  current_model.to("cpu")
119
  torch.cuda.empty_cache()
120
 
 
 
121
 
122
  # Globals
123
  current_model = None
 
92
  streamer.end_of_generation.set() # signal to stop generation thread
93
  break
94
 
95
+ if "\nUser:" in token_str:
96
+ break
97
+
98
  if "<think>" in token_str:
99
  in_think = True
100
  token_str = token_str.replace("<think>", "")
 
121
  current_model.to("cpu")
122
  torch.cuda.empty_cache()
123
 
124
+ return messages
125
+
126
 
127
  # Globals
128
  current_model = None