mirror of
https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-06-05 09:10:25 +08:00
optimize(f0): move fcpe into rvc.f0
This commit is contained in:
@@ -14,7 +14,7 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
from scipy import signal
|
||||
|
||||
from rvc.f0 import PM, Harvest, RMVPE, CRePE, Dio
|
||||
from rvc.f0 import PM, Harvest, RMVPE, CRePE, Dio, FCPE
|
||||
|
||||
now_dir = os.getcwd()
|
||||
sys.path.append(now_dir)
|
||||
@@ -118,21 +118,15 @@ class Pipeline(object):
|
||||
|
||||
elif f0_method == "fcpe":
|
||||
if not hasattr(self, "model_fcpe"):
|
||||
from torchfcpe import spawn_bundled_infer_model
|
||||
|
||||
logger.info("Loading fcpe model")
|
||||
self.model_fcpe = spawn_bundled_infer_model(self.device)
|
||||
f0 = (
|
||||
self.model_fcpe.infer(
|
||||
torch.from_numpy(x).to(self.device).unsqueeze(0).float(),
|
||||
sr=16000,
|
||||
decoder_mode="local_argmax",
|
||||
threshold=0.006,
|
||||
self.model_fcpe = FCPE(
|
||||
self.window,
|
||||
f0_min,
|
||||
f0_max,
|
||||
self.sr,
|
||||
self.device,
|
||||
)
|
||||
.squeeze()
|
||||
.cpu()
|
||||
.numpy()
|
||||
)
|
||||
f0 = self.model_fcpe.compute_f0(x, p_len=p_len)
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
# with open("test.txt","w")as f:f.write("\n".join([str(i)for i in f0.tolist()]))
|
||||
|
||||
Reference in New Issue
Block a user