mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Update auto_model.py
修复空字串进入speaker model时报raw_text变量不存在的bug
This commit is contained in:
parent
1300d38bf0
commit
648c03fdbb
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user