Luigi commited on
Commit
afa1066
·
1 Parent(s): f0d2ab7

Restore proper cancel functionality

Browse files

- Revert stopping criteria to check cancel_event.is_set()
- Confirmed stopping criteria mechanism works (generation stopped after 1 token in test)
- Cancel should now work properly, stopping generation after current token when clicked

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -28,7 +28,7 @@ cancel_event = threading.Event()
28
  # ------------------------------
29
  class CancelStoppingCriteria(StoppingCriteria):
30
  def __call__(self, input_ids, scores, **kwargs):
31
- return True
32
 
33
  # ------------------------------
34
  # Torch-Compatible Model Definitions with Adjusted Descriptions
 
28
  # ------------------------------
29
  class CancelStoppingCriteria(StoppingCriteria):
30
  def __call__(self, input_ids, scores, **kwargs):
31
+ return cancel_event.is_set()
32
 
33
  # ------------------------------
34
  # Torch-Compatible Model Definitions with Adjusted Descriptions