Merge branch 'RVC-Boss:main' into dev

This commit is contained in:
Spr_Aachen 2025-02-01 19:19:33 +08:00 committed by GitHub
commit 5be9465559
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 14 deletions

View File

@ -3,8 +3,8 @@
import sys
import re
import cn2an
import ToJyutping
from pyjyutping import jyutping
from text.symbols import punctuation
from text.zh_normalization.text_normlization import TextNormalizer
@ -173,12 +173,24 @@ def jyuping_to_initials_finals_tones(jyuping_syllables):
def get_jyutping(text):
jp = jyutping.convert(text)
# print(1111111,jp)
for symbol in punctuation:
jp = jp.replace(symbol, " " + symbol + " ")
jp_array = jp.split()
return jp_array
jyutping_array = []
punct_pattern = re.compile(r"^[{}]+$".format(re.escape("".join(punctuation))))
syllables = ToJyutping.get_jyutping_list(text)
for word, syllable in syllables:
if punct_pattern.match(word):
puncts = re.split(r"([{}])".format(re.escape("".join(punctuation))), word)
for punct in puncts:
if len(punct) > 0:
jyutping_array.append(punct)
else:
# match multple jyutping eg: liu4 ge3, or single jyutping eg: liu4
if not re.search(r"^([a-z]+[1-6]+[ ]?)+$", syllable):
raise ValueError(f"Failed to convert {word} to jyutping: {syllable}")
jyutping_array.append(syllable)
return jyutping_array
def get_bert_feature(text, word2ph):

View File

@ -144,11 +144,16 @@ def read_dict():
return polyphonic_dict
def correct_pronunciation(word,word_pinyins):
if word in pp_dict:
word_pinyins = pp_dict[word]
return word_pinyins
def correct_pronunciation(word, word_pinyins):
new_pinyins = pp_dict.get(word, "")
if new_pinyins == "":
for idx, w in enumerate(word):
w_pinyin = pp_dict.get(w, "")
if w_pinyin != "":
word_pinyins[idx] = w_pinyin[0]
return word_pinyins
else:
return new_pinyins
pp_dict = get_dict()

View File

@ -27,7 +27,7 @@ LangSegment>=0.2.0
Faster_Whisper
wordsegment
rotary_embedding_torch
pyjyutping
ToJyutping
g2pk2
ko_pron
opencc; sys_platform != 'linux'

View File

@ -72,7 +72,7 @@ mem = []
if_gpu_ok = False
# 判断是否有能用来训练和加速推理的N卡
ok_gpu_keywords={"10","16","20","30","40","A2","A3","A4","P4","A50","500","A60","70","80","90","M4","T4","TITAN","L4","4060","H"}
ok_gpu_keywords={"10","16","20","30","40","A2","A3","A4","P4","A50","500","A60","70","80","90","M4","T4","TITAN","L4","4060","H","600"}
set_gpu_numbers=set()
if torch.cuda.is_available() or ngpu != 0:
for i in range(ngpu):