Skip to content

Commit b77745c

Browse files
authored
Automatic code formatting (#77)
Automatic code formatting
2 parents 09f312e + d5ae208 commit b77745c

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

rvc/infer/pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_f0(
8989
del model
9090
elif f0_method == "fcpe":
9191
model = FCPE(device=self.device, sample_rate=self.sample_rate, hop_size=self.window)
92-
f0 = model.get_f0(x, p_len, filter_radius = 0.006)
92+
f0 = model.get_f0(x, p_len, filter_radius=0.006)
9393
del model
9494

9595
if f0 is None:
@@ -177,7 +177,7 @@ def vc(
177177
del hasp, arg
178178

179179
if protect < 0.5 and pitch is not None and pitchf is not None:
180-
del feats0
180+
del feats0
181181
del feats, padding_mask
182182
if torch.cuda.is_available():
183183
torch.cuda.empty_cache()

rvc/lib/predictors/f0.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
2+
23
import torch
4+
import torchcrepe
5+
from torchfcpe import spawn_bundled_infer_model
36

47
from rvc.lib.predictors.RMVPE import RMVPE0Predictor
5-
from torchfcpe import spawn_bundled_infer_model
6-
import torchcrepe
78

89

910
class RMVPE:
@@ -31,7 +32,7 @@ def get_f0(self, x, f0_min=50, f0_max=1100, p_len=None, model="full"):
3132
if not torch.is_tensor(x):
3233
x = torch.from_numpy(x)
3334

34-
batch_size = 512
35+
batch_size = 512
3536

3637
f0, pd = torchcrepe.predict(
3738
x.float().to(self.device).unsqueeze(dim=0),
@@ -59,18 +60,23 @@ def __init__(self, device, sample_rate=16000, hop_size=160):
5960
self.hop_size = hop_size
6061
self.model = spawn_bundled_infer_model(self.device)
6162

62-
def get_f0(self, x, p_len=None, filter_radius = 0.006):
63+
def get_f0(self, x, p_len=None, filter_radius=0.006):
6364
if p_len is None:
6465
p_len = x.shape[0] // self.hop_size
6566

6667
if not torch.is_tensor(x):
6768
x = torch.from_numpy(x)
6869

69-
f0 = self.model.infer(
70+
f0 = (
71+
self.model.infer(
7072
x.float().to(self.device).unsqueeze(0),
7173
sr=self.sample_rate,
7274
decoder_mode="local_argmax",
7375
threshold=filter_radius,
74-
).squeeze().cpu().numpy()
76+
)
77+
.squeeze()
78+
.cpu()
79+
.numpy()
80+
)
7581

7682
return f0

0 commit comments

Comments
 (0)