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

optimize(f0): move fcpe into rvc.f0

This commit is contained in:
源文雨
2024-06-14 21:33:46 +09:00
parent 24dbc5edd2
commit 3b7d7c6d1a
6 changed files with 70 additions and 32 deletions

View File

@@ -16,6 +16,8 @@ class CRePE(F0Predictor):
sampling_rate=44100,
device="cpu",
):
if "privateuseone" in str(device):
device = "cpu"
super().__init__(
hop_length,
f0_min,
@@ -32,11 +34,13 @@ class CRePE(F0Predictor):
):
if p_len is None:
p_len = wav.shape[0] // self.hop_length
if not torch.is_tensor(wav):
wav = torch.from_numpy(wav)
# Pick a batch size that doesn't cause memory errors on your gpu
batch_size = 512
# Compute pitch using device 'device'
f0, pd = torchcrepe.predict(
torch.tensor(np.copy(wav))[None].float().to(self.device),
wav.float().to(self.device).unsqueeze(dim=0),
self.sampling_rate,
self.hop_length,
self.f0_min,