From 12496e559feea69af2e77eac6f22b32df3bf6762 Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期四, 18 一月 2024 23:21:12 +0800
Subject: [PATCH] streaming bugfix (#1271)
---
funasr/models/fsmn_vad_streaming/model.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/funasr/models/fsmn_vad_streaming/model.py b/funasr/models/fsmn_vad_streaming/model.py
index 943cb47..7c21561 100644
--- a/funasr/models/fsmn_vad_streaming/model.py
+++ b/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:
--
Gitblit v1.9.1