Update infer_tool.py

增加清理显存函数,方便频繁生成
This commit is contained in:
友利奈绪是我的 2023-03-11 23:33:18 +08:00 committed by GitHub
parent 01f2a51ead
commit 8a88015d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -181,6 +181,10 @@ class Svc(object):
use_time = time.time() - start
print("vits use time:{}".format(use_time))
return audio, audio.shape[-1]
def clear_empty(self):
# 清理显存
torch.cuda.empty_cache()
def slice_inference(self,raw_audio_path, spk, tran, slice_db,cluster_infer_ratio, auto_predict_f0,noice_scale, pad_seconds=0.5):
wav_path = raw_audio_path