Browse Source

support in_cache (#560)

lingyunfly 2 years ago
parent
commit
80f90dd076
1 changed files with 2 additions and 0 deletions
  1. 2 0
      funasr/models/e2e_vad.py

+ 2 - 0
funasr/models/e2e_vad.py

@@ -501,6 +501,8 @@ class E2EVadModel(nn.Module):
     def forward_online(self, feats: torch.Tensor, waveform: torch.tensor, in_cache: Dict[str, torch.Tensor] = dict(),
                        is_final: bool = False, max_end_sil: int = 800
                        ) -> Tuple[List[List[List[int]]], Dict[str, torch.Tensor]]:
+        if not in_cache:
+            self.AllResetDetection()
         self.max_end_sil_frame_cnt_thresh = max_end_sil - self.vad_opts.speech_to_sil_time_thres
         self.waveform = waveform  # compute decibel for each frame