From c70f091182e76676209295ce51452f5d84df54f1 Mon Sep 17 00:00:00 2001 From: "0.0" <3388065969@qq.com> Date: Tue, 21 Jul 2026 11:20:23 +0800 Subject: [PATCH] fix: correct type annotation and file encoding for cross-platform support --- GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py | 2 +- GPT_SoVITS/text/chinese.py | 2 +- GPT_SoVITS/text/chinese2.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py index 283e91c3..3ca1399b 100644 --- a/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py +++ b/GPT_SoVITS/TTS_infer_pack/TextPreprocessor.py @@ -31,7 +31,7 @@ def get_first(text: str) -> str: return text -def merge_short_text_in_array(texts: str, threshold: int) -> list: +def merge_short_text_in_array(texts: List[str], threshold: int) -> list: if (len(texts)) < 2: return texts result = [] diff --git a/GPT_SoVITS/text/chinese.py b/GPT_SoVITS/text/chinese.py index 944c9cb7..271dbf04 100644 --- a/GPT_SoVITS/text/chinese.py +++ b/GPT_SoVITS/text/chinese.py @@ -13,7 +13,7 @@ normalizer = lambda x: cn2an.transform(x, "an2cn") current_file_path = os.path.dirname(__file__) pinyin_to_symbol_map = { line.split("\t")[0]: line.strip().split("\t")[1] - for line in open(os.path.join(current_file_path, "opencpop-strict.txt")).readlines() + for line in open(os.path.join(current_file_path, "opencpop-strict.txt"), encoding="utf-8").readlines() } import jieba_fast diff --git a/GPT_SoVITS/text/chinese2.py b/GPT_SoVITS/text/chinese2.py index acfebfe2..c076efea 100644 --- a/GPT_SoVITS/text/chinese2.py +++ b/GPT_SoVITS/text/chinese2.py @@ -14,7 +14,7 @@ normalizer = lambda x: cn2an.transform(x, "an2cn") current_file_path = os.path.dirname(__file__) pinyin_to_symbol_map = { line.split("\t")[0]: line.strip().split("\t")[1] - for line in open(os.path.join(current_file_path, "opencpop-strict.txt")).readlines() + for line in open(os.path.join(current_file_path, "opencpop-strict.txt"), encoding="utf-8").readlines() } import jieba_fast