Fix: Converts the given “N” phoneme to “n” when use_jp_extra=False

Non-JP-Extra pre-trained models (based on Bert-VITS2 v2.1) do not distinguish between “ん” and consonant “n” due to an implementation miss.
This commit is contained in:
tsukumi
2024-09-03 13:58:53 +09:00
parent c140c0612a
commit 7c5e839e82

View File

@@ -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 が著しく乖離していて調整し切れなかったことを意味する