mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-04-06 03:57:44 +08:00
Add files via upload
This commit is contained in:
parent
f1bcf13fd3
commit
c2b5b284ec
@ -86,6 +86,7 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
def get_bert_feature(text, word2ph):
|
def get_bert_feature(text, word2ph):
|
||||||
|
print(23333334444444,text,word2ph)
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
inputs = tokenizer(text, return_tensors="pt")
|
inputs = tokenizer(text, return_tensors="pt")
|
||||||
for i in inputs:
|
for i in inputs:
|
||||||
@ -332,11 +333,11 @@ def get_cleaned_text_final(text,language):
|
|||||||
return phones, word2ph, norm_text
|
return phones, word2ph, norm_text
|
||||||
|
|
||||||
def get_bert_final(phones, word2ph, text,language,device):
|
def get_bert_final(phones, word2ph, text,language,device):
|
||||||
if text_language == "en":
|
if language == "en":
|
||||||
bert = get_bert_inf(phones, word2ph, text, language)
|
bert = get_bert_inf(phones, word2ph, text, language)
|
||||||
elif text_language in {"zh", "ja","auto"}:
|
elif language in {"zh", "ja","auto"}:
|
||||||
bert = nonen_get_bert_inf(text, language)
|
bert = nonen_get_bert_inf(text, language)
|
||||||
elif text_language == "all_zh":
|
elif language == "all_zh":
|
||||||
bert = get_bert_feature(text, word2ph).to(device)
|
bert = get_bert_feature(text, word2ph).to(device)
|
||||||
else:
|
else:
|
||||||
bert = torch.zeros((1024, len(phones))).to(device)
|
bert = torch.zeros((1024, len(phones))).to(device)
|
||||||
@ -376,9 +377,10 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
|||||||
) # .float()
|
) # .float()
|
||||||
codes = vq_model.extract_latent(ssl_content)
|
codes = vq_model.extract_latent(ssl_content)
|
||||||
prompt_semantic = codes[0, 0]
|
prompt_semantic = codes[0, 0]
|
||||||
|
|
||||||
t1 = ttime()
|
t1 = ttime()
|
||||||
|
|
||||||
phones1, word2ph1, norm_text1=get_cleaned_text_final(prompt_text, prompt_language)
|
phones1, word2ph1, norm_text1=get_cleaned_text_final(prompt_text, prompt_language)
|
||||||
|
|
||||||
if (how_to_cut == i18n("凑四句一切")):
|
if (how_to_cut == i18n("凑四句一切")):
|
||||||
text = cut1(text)
|
text = cut1(text)
|
||||||
elif (how_to_cut == i18n("凑50字一切")):
|
elif (how_to_cut == i18n("凑50字一切")):
|
||||||
@ -403,7 +405,7 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language,
|
|||||||
print(i18n("实际输入的目标文本(每句):"), text)
|
print(i18n("实际输入的目标文本(每句):"), text)
|
||||||
phones2, word2ph2, norm_text2 = get_cleaned_text_final(text, text_language)
|
phones2, word2ph2, norm_text2 = get_cleaned_text_final(text, text_language)
|
||||||
bert2 = get_bert_final(phones2, word2ph2, norm_text2, text_language, device).to(dtype)
|
bert2 = get_bert_final(phones2, word2ph2, norm_text2, text_language, device).to(dtype)
|
||||||
|
print(bert1,bert2)
|
||||||
bert = torch.cat([bert1, bert2], 1)
|
bert = torch.cat([bert1, bert2], 1)
|
||||||
|
|
||||||
all_phoneme_ids = torch.LongTensor(phones1 + phones2).to(device).unsqueeze(0)
|
all_phoneme_ids = torch.LongTensor(phones1 + phones2).to(device).unsqueeze(0)
|
||||||
@ -582,7 +584,7 @@ with gr.Blocks(title="GPT-SoVITS WebUI") as app:
|
|||||||
inp_ref = gr.Audio(label=i18n("请上传3~10秒内参考音频,超过会报错!"), type="filepath")
|
inp_ref = gr.Audio(label=i18n("请上传3~10秒内参考音频,超过会报错!"), type="filepath")
|
||||||
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
prompt_text = gr.Textbox(label=i18n("参考音频的文本"), value="")
|
||||||
prompt_language = gr.Dropdown(
|
prompt_language = gr.Dropdown(
|
||||||
label=i18n("参考音频的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文")], value=i18n("中文")
|
label=i18n("参考音频的语种"), choices=[i18n("中文"), i18n("英文"), i18n("日文"), i18n("中英混合"), i18n("日英混合"), i18n("多语种混合")], value=i18n("中文")
|
||||||
)
|
)
|
||||||
gr.Markdown(value=i18n("*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。"))
|
gr.Markdown(value=i18n("*请填写需要合成的目标文本。中英混合选中文,日英混合选日文,中日混合暂不支持,非目标语言文本自动遗弃。"))
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user