mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-02-19 10:50:44 +00:00
optimize real-time vc
This commit is contained in:
@@ -593,16 +593,18 @@ class RMVPE:
|
||||
|
||||
def infer_from_audio(self, audio, thred=0.03):
|
||||
# torch.cuda.synchronize()
|
||||
t0 = ttime()
|
||||
# t0 = ttime()
|
||||
if not torch.is_tensor(audio):
|
||||
audio = torch.from_numpy(audio)
|
||||
mel = self.mel_extractor(
|
||||
torch.from_numpy(audio).float().to(self.device).unsqueeze(0), center=True
|
||||
audio.float().to(self.device).unsqueeze(0), center=True
|
||||
)
|
||||
# print(123123123,mel.device.type)
|
||||
# torch.cuda.synchronize()
|
||||
t1 = ttime()
|
||||
# t1 = ttime()
|
||||
hidden = self.mel2hidden(mel)
|
||||
# torch.cuda.synchronize()
|
||||
t2 = ttime()
|
||||
# t2 = ttime()
|
||||
# print(234234,hidden.device.type)
|
||||
if "privateuseone" not in str(self.device):
|
||||
hidden = hidden.squeeze(0).cpu().numpy()
|
||||
@@ -613,7 +615,7 @@ class RMVPE:
|
||||
|
||||
f0 = self.decode(hidden, thred=thred)
|
||||
# torch.cuda.synchronize()
|
||||
t3 = ttime()
|
||||
# t3 = ttime()
|
||||
# print("hmvpe:%s\t%s\t%s\t%s"%(t1-t0,t2-t1,t3-t2,t3-t0))
|
||||
return f0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user