hzhwcmhf commited on
Commit
19bada9
·
verified ·
1 Parent(s): ebda012

Update modeling_qwen3_guard.py

Browse files
Files changed (1) hide show
  1. modeling_qwen3_guard.py +9 -0
modeling_qwen3_guard.py CHANGED
@@ -626,6 +626,15 @@ class Qwen3ForGuardModel(Qwen3PreTrainedModel):
626
 
627
  return result, stream_state
628
 
 
 
 
 
 
 
 
 
 
629
 
630
  __all__ = [
631
  "Qwen3PreTrainedModel",
 
626
 
627
  return result, stream_state
628
 
629
+ @torch.no_grad()
630
+ def close_stream(self, stream_state: Optional[Generator]) -> None:
631
+ if stream_state is not None:
632
+ try:
633
+ stream_state.send(None)
634
+ except StopIteration:
635
+ pass
636
+ finally:
637
+ stream_state.close()
638
 
639
  __all__ = [
640
  "Qwen3PreTrainedModel",