From 4208e7635c46fb8ee81056d5d28c0ad9bdc11afa Mon Sep 17 00:00:00 2001 From: CyberWon Date: Fri, 25 Apr 2025 17:57:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E8=BD=AF=E4=BB=B6import=E6=97=B6=EF=BC=8C=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPT_SoVITS/text/chinese2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GPT_SoVITS/text/chinese2.py b/GPT_SoVITS/text/chinese2.py index 612aa3a5..4d415fd5 100644 --- a/GPT_SoVITS/text/chinese2.py +++ b/GPT_SoVITS/text/chinese2.py @@ -31,9 +31,12 @@ if is_g2pw: from text.g2pw import G2PWPinyin, correct_pronunciation parent_directory = os.path.dirname(current_file_path) + # 防止作为第三方库导入时,找不到模型文件 + model_dir = os.path.join(current_file_path, "G2PWModel") + model_source = os.path.join(parent_directory, "pretrained_models/chinese-roberta-wwm-ext-large") g2pw = G2PWPinyin( - model_dir="GPT_SoVITS/text/G2PWModel", - model_source=os.environ.get("bert_path", "GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large"), + model_dir=model_dir, + model_source=os.environ.get("bert_path", model_source), v_to_u=False, neutral_tone_with_five=True, )