Merge 24218b27b44dced7320238f4bf0c115f1ff3ebb8 into 7bc0836d9933402215ce529da7f50bd1a8c63f7f

This commit is contained in:
XXXXRT666 2024-03-21 04:31:40 +08:00 committed by GitHub
commit 324e7d2544
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

9
api.py
View File

@ -412,7 +412,14 @@ def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language)
early_stop_num=hz * max_sec)
t3 = ttime()
# print(pred_semantic.shape,idx)
pred_semantic = pred_semantic[:, -idx:].unsqueeze(0) # .unsqueeze(0)#mq要多unsqueeze一次
if isinstance(pred_semantic, list) and isinstance(pred_semantic, list):
pred_semantic = pred_semantic[0]
idx=idx[0]
pred_semantic = pred_semantic[-idx:]
pred_semantic = pred_semantic.unsqueeze(0).unsqueeze(0)
else:
pred_semantic = pred_semantic[:,-idx:]
pred_semantic = pred_semantic.unsqueeze(0) # .unsqueeze(0)#mq要多unsqueeze一次
refer = get_spepc(hps, ref_wav_path) # .to(device)
if (is_half == True):
refer = refer.half().to(device)