1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-08 12:00:49 +08:00

optimize(crepe): move crepe into rvc.f0

This commit is contained in:
源文雨
2024-06-14 14:29:36 +09:00
parent f79b925ee2
commit e298fde29c
7 changed files with 106 additions and 54 deletions

View File

@@ -292,22 +292,16 @@ class RVC:
self.device
): ###不支持dmlcpu又太慢用不成拿fcpe顶替
return self.get_f0(x, f0_up_key, 1, "fcpe")
# printt("using crepe,device:%s"%self.device)
f0, pd = torchcrepe.predict(
x.unsqueeze(0).float(),
16000,
160,
self.f0_min,
self.f0_max,
"full",
batch_size=512,
# device=self.device if self.device.type!="privateuseone" else "cpu",###crepe不用半精度全部是全精度所以不愁###cpu延迟高到没法用
device=self.device,
return_periodicity=True,
)
pd = torchcrepe.filter.median(pd, 3)
f0 = torchcrepe.filter.mean(f0, 3)
f0[pd < 0.1] = 0
if hasattr(self, "model_crepe") == False:
from rvc.f0 import CRePE
self.model_crepe = CRePE(
160,
self.f0_min,
self.f0_max,
16000,
self.device,
)
f0 = self.model_crepe.compute_f0(x)
f0 *= pow(2, f0_up_key / 12)
return self.get_f0_post(f0)