Spaces:
Running
Running
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
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
|
| 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
|