zhifu gao
2024-01-18 12496e559feea69af2e77eac6f22b32df3bf6762
funasr/models/fsmn_vad_streaming/model.py
@@ -501,7 +501,9 @@
      #     self.AllResetDetection()
      return segments
   
   def init_cache(self, cache: dict = {}, **kwargs):
      cache["frontend"] = {}
      cache["prev_samples"] = torch.empty(0)
      cache["encoder"] = {}
@@ -528,7 +530,7 @@
                 cache: dict = {},
                 **kwargs,
                 ):
      if len(cache) == 0:
         self.init_cache(cache, **kwargs)
      
@@ -583,7 +585,7 @@
      
      cache["prev_samples"] = audio_sample[:-m]
      if _is_final:
         cache = {}
         self.init_cache(cache)
      
      ibest_writer = None
      if ibest_writer is None and kwargs.get("output_dir") is not None: