add empty cache

This commit is contained in:
Stardust·减
2023-09-05 20:39:56 +08:00
committed by GitHub
parent 7ba432978b
commit 5adb7a11bc

View File

@@ -78,6 +78,7 @@ def infer(text, sdp_ratio, noise_scale, noise_scale_w, length_scale, sid, langua
def tts_fn(text, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale, language): def tts_fn(text, speaker, sdp_ratio, noise_scale, noise_scale_w, length_scale, language):
with torch.no_grad(): with torch.no_grad():
audio = infer(text, sdp_ratio=sdp_ratio, noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale, sid=speaker, language=language) audio = infer(text, sdp_ratio=sdp_ratio, noise_scale=noise_scale, noise_scale_w=noise_scale_w, length_scale=length_scale, sid=speaker, language=language)
torch.cuda.empty_cache()
return "Success", (hps.data.sampling_rate, audio) return "Success", (hps.data.sampling_rate, audio)