From 7c5e839e825c47bde1e51be4eacbac8ef9538124 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Tue, 3 Sep 2024 13:58:53 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20Converts=20the=20given=20=E2=80=9CN?= =?UTF-8?q?=E2=80=9D=20phoneme=20to=20=E2=80=9Cn=E2=80=9D=20when=20use=5Fj?= =?UTF-8?q?p=5Fextra=3DFalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-JP-Extra pre-trained models (based on Bert-VITS2 v2.1) do not distinguish between “ん” and consonant “n” due to an implementation miss. --- style_bert_vits2/models/infer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/style_bert_vits2/models/infer.py b/style_bert_vits2/models/infer.py index 9b83803..92c815a 100644 --- a/style_bert_vits2/models/infer.py +++ b/style_bert_vits2/models/infer.py @@ -127,6 +127,10 @@ def get_text( if language_str == Languages.JP: from style_bert_vits2.nlp.japanese.g2p import adjust_word2ph + # use_jp_extra でない場合は given_phone 内の「N」を「n」に変換 + if not use_jp_extra: + given_phone = [p if p != "N" else "n" for p in given_phone] + # clean_text() から取得した word2ph を調整結果で上書き word2ph = adjust_word2ph(word2ph, phone, given_phone) # 上記処理により word2ph の合計が given_phone の長さと一致するはず # それでも一致しない場合、大半は読み上げテキストと given_phone が著しく乖離していて調整し切れなかったことを意味する