mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-04-06 03:57:44 +08:00
修复开头吞字
This commit is contained in:
parent
8ccb0d2eed
commit
d8d65415d1
@ -29,10 +29,10 @@ else:
|
|||||||
# )
|
# )
|
||||||
# sovits_path = os.environ.get("sovits_path", "pretrained_models/s2G488k.pth")
|
# sovits_path = os.environ.get("sovits_path", "pretrained_models/s2G488k.pth")
|
||||||
cnhubert_base_path = os.environ.get(
|
cnhubert_base_path = os.environ.get(
|
||||||
"cnhubert_base_path", "pretrained_models/chinese-hubert-base"
|
"cnhubert_base_path", "GPT_SoVITS/pretrained_models/chinese-hubert-base"
|
||||||
)
|
)
|
||||||
bert_path = os.environ.get(
|
bert_path = os.environ.get(
|
||||||
"bert_path", "pretrained_models/chinese-roberta-wwm-ext-large"
|
"bert_path", "GPT_SoVITS/pretrained_models/chinese-roberta-wwm-ext-large"
|
||||||
)
|
)
|
||||||
infer_ttswebui = os.environ.get("infer_ttswebui", 9872)
|
infer_ttswebui = os.environ.get("infer_ttswebui", 9872)
|
||||||
infer_ttswebui = int(infer_ttswebui)
|
infer_ttswebui = int(infer_ttswebui)
|
||||||
@ -262,11 +262,18 @@ def nonen_get_bert_inf(text, language):
|
|||||||
|
|
||||||
return bert
|
return bert
|
||||||
|
|
||||||
|
splits = {",","。","?","!",",",".","?","!","~",":",":","—","…",}
|
||||||
|
def get_first(text):
|
||||||
|
pattern = "[" + "".join(re.escape(sep) for sep in splits) + "]"
|
||||||
|
text = re.split(pattern, text)[0].strip()
|
||||||
|
return text
|
||||||
|
|
||||||
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,how_to_cut=i18n("不切")):
|
def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,how_to_cut=i18n("不切")):
|
||||||
t0 = ttime()
|
t0 = ttime()
|
||||||
prompt_text = prompt_text.strip("\n")
|
prompt_text = prompt_text.strip("\n")
|
||||||
if(prompt_text[-1]not in splits):prompt_text+="。"if prompt_text!="en"else "."
|
if(prompt_text[-1]not in splits):prompt_text+="。"if prompt_text!="en"else "."
|
||||||
text = text.strip("\n")
|
text = text.strip("\n")
|
||||||
|
if(len(get_first(text))<4):text+="。"if text!="en"else "."
|
||||||
zero_wav = np.zeros(
|
zero_wav = np.zeros(
|
||||||
int(hps.data.sampling_rate * 0.3),
|
int(hps.data.sampling_rate * 0.3),
|
||||||
dtype=np.float16 if is_half == True else np.float32,
|
dtype=np.float16 if is_half == True else np.float32,
|
||||||
@ -371,24 +378,6 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
|||||||
np.int16
|
np.int16
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
splits = {
|
|
||||||
",",
|
|
||||||
"。",
|
|
||||||
"?",
|
|
||||||
"!",
|
|
||||||
",",
|
|
||||||
".",
|
|
||||||
"?",
|
|
||||||
"!",
|
|
||||||
"~",
|
|
||||||
":",
|
|
||||||
":",
|
|
||||||
"—",
|
|
||||||
"…",
|
|
||||||
} # 不考虑省略号
|
|
||||||
|
|
||||||
|
|
||||||
def split(todo_text):
|
def split(todo_text):
|
||||||
todo_text = todo_text.replace("……", "。").replace("——", ",")
|
todo_text = todo_text.replace("……", "。").replace("——", ",")
|
||||||
if todo_text[-1] not in splits:
|
if todo_text[-1] not in splits:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user