From 2cca8104d26b454112f39b8405dcb0e70d365990 Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期五, 19 一月 2024 17:05:08 +0800
Subject: [PATCH] Funasr1.0 (#1275)

---
 funasr/models/fsmn_vad_streaming/model.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/funasr/models/fsmn_vad_streaming/model.py b/funasr/models/fsmn_vad_streaming/model.py
index 943cb47..becfd56 100644
--- a/funasr/models/fsmn_vad_streaming/model.py
+++ b/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:

--
Gitblit v1.9.1