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:
@@ -292,22 +292,16 @@ class RVC:
|
||||
self.device
|
||||
): ###不支持dml,cpu又太慢用不成,拿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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user