fix(vc.hash): embed rmvpe result

This commit is contained in:
源文雨 2024-06-04 21:20:32 +09:00
parent de848286b2
commit ee72eca6a5
3 changed files with 20 additions and 12 deletions

View File

@ -102,7 +102,7 @@ def model_hash(config, tgt_sr, net_g, if_f0, version):
"rmvpe", "rmvpe",
"", "",
0, 0,
if_f0, 2 if if_f0 else 0,
3, 3,
tgt_sr, tgt_sr,
16000, 16000,

Binary file not shown.

View File

@ -16,6 +16,7 @@ import pyworld
import torch import torch
import torch.nn.functional as F import torch.nn.functional as F
import torchcrepe import torchcrepe
import pathlib
from scipy import signal from scipy import signal
now_dir = os.getcwd() now_dir = os.getcwd()
@ -374,15 +375,22 @@ class Pipeline(object):
traceback.print_exc() traceback.print_exc()
sid = torch.tensor(sid, device=self.device).unsqueeze(0).long() sid = torch.tensor(sid, device=self.device).unsqueeze(0).long()
pitch, pitchf = None, None pitch, pitchf = None, None
if if_f0 == 1: if if_f0:
pitch, pitchf = self.get_f0( if if_f0 == 1:
audio_pad, pitch, pitchf = self.get_f0(
p_len, audio_pad,
f0_up_key, p_len,
f0_method, f0_up_key,
filter_radius, f0_method,
inp_f0, filter_radius,
) inp_f0,
)
"""
np.savez_compressed(pathlib.Path(__file__).parent / "lgdsng_f0.npz", pitch=pitch, pitchf=pitchf)
"""
elif if_f0 == 2:
pitchz = np.load(pathlib.Path(__file__).parent / "lgdsng_f0.npz")
pitch, pitchf = pitchz["pitch"], pitchz["pitchf"]
pitch = pitch[:p_len] pitch = pitch[:p_len]
pitchf = pitchf[:p_len] pitchf = pitchf[:p_len]
if "mps" not in str(self.device) or "xpu" not in str(self.device): if "mps" not in str(self.device) or "xpu" not in str(self.device):
@ -393,7 +401,7 @@ class Pipeline(object):
times[1] += t2 - t1 times[1] += t2 - t1
for t in opt_ts: for t in opt_ts:
t = t // self.window * self.window t = t // self.window * self.window
if if_f0 == 1: if if_f0:
audio_opt.append( audio_opt.append(
self.vc( self.vc(
model, model,
@ -428,7 +436,7 @@ class Pipeline(object):
)[self.t_pad_tgt : -self.t_pad_tgt] )[self.t_pad_tgt : -self.t_pad_tgt]
) )
s = t s = t
if if_f0 == 1: if if_f0:
audio_opt.append( audio_opt.append(
self.vc( self.vc(
model, model,