zhifu gao
2024-01-19 2cca8104d26b454112f39b8405dcb0e70d365990
funasr/models/fsmn_vad_streaming/model.py
@@ -255,7 +255,6 @@
      self.waveform = None
      self.last_drop_frames = 0
@tables.register("model_classes", "FsmnVADStreaming")
class FsmnVADStreaming(nn.Module):
   """
@@ -500,8 +499,9 @@
      #     # reset class variables and clear the dict for the next query
      #     self.AllResetDetection()
      return segments
   def init_cache(self, cache: dict = {}, **kwargs):
      cache["frontend"] = {}
      cache["prev_samples"] = torch.empty(0)
      cache["encoder"] = {}
@@ -528,7 +528,7 @@
                 cache: dict = {},
                 **kwargs,
                 ):
      if len(cache) == 0:
         self.init_cache(cache, **kwargs)
      
@@ -583,7 +583,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: