From aee85fd98f2fb7e2b8446fd5924010707c1efdda Mon Sep 17 00:00:00 2001 From: CyberWon Date: Tue, 11 Jun 2024 20:45:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=82=E8=80=83?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98=20(#1176?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update TextPreprocessor.py * fix: 修复参考音频泄露的问题。 1. 之前变量命名有错误 2. 还存在参考音频泄露问题。 * 调整一下判断纯符号所处的函数,更符号逻辑 --- GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py index 2cc0023..0891227 100644 --- a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py +++ b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py @@ -56,7 +56,7 @@ class TextPreprocessor: def preprocess(self, text:str, lang:str, text_split_method:str)->List[Dict]: print(i18n("############ 切分文本 ############")) - texts = self.replace_consecutive_punctuation(texts) + text = self.replace_consecutive_punctuation(text) # 变量命名应该是写错了 texts = self.pre_seg_text(text, lang, text_split_method) result = [] print(i18n("############ 提取文本Bert特征 ############")) @@ -94,6 +94,9 @@ class TextPreprocessor: for text in _texts: # 解决输入目标文本的空行导致报错的问题 if (len(text.strip()) == 0): + continue + if not re.sub("\W+", "", text): + # 检测一下,如果是纯符号,就跳过。 continue if (text[-1] not in splits): text += "。" if lang != "en" else "."