From 648c03fdbba045acf8e25c5e6f7df0f27937c3cf Mon Sep 17 00:00:00 2001 From: liugz18 <57401541+liugz18@users.noreply.github.com> Date: Wed, 12 Jun 2024 12:30:00 +0800 Subject: [PATCH] Update auto_model.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复空字串进入speaker model时报raw_text变量不存在的bug --- funasr/auto/auto_model.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/funasr/auto/auto_model.py b/funasr/auto/auto_model.py index 4418b6ae7..9f8e4dc13 100644 --- a/funasr/auto/auto_model.py +++ b/funasr/auto/auto_model.py @@ -469,10 +469,11 @@ class AutoModel: return_raw_text = kwargs.get("return_raw_text", False) # step.3 compute punc model + raw_text = None if self.punc_model is not None: if not len(result["text"].strip()): if return_raw_text: - result["raw_text"] = "" + result["raw_text"] = raw_text = "" else: deep_update(self.punc_kwargs, cfg) punc_res = self.inference( @@ -482,9 +483,7 @@ class AutoModel: if return_raw_text: result["raw_text"] = raw_text result["text"] = punc_res[0]["text"] - else: - raw_text = None - + # speaker embedding cluster after resorted if self.spk_model is not None and kwargs.get("return_spk_res", True): if raw_text is None: