Skip to content

Commit d9a116f

Browse files
committed
fix(train): mysterious importing order
1 parent add4642 commit d9a116f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

rvc/f0/fcpe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from typing import Any, Optional, Union
1+
from typing import Optional, Union
22

33
import numpy as np
44
import torch
5-
from torchfcpe import spawn_bundled_infer_model
65

76
from .f0 import F0Predictor
87

@@ -24,6 +23,8 @@ def __init__(
2423
device,
2524
)
2625

26+
from torchfcpe import spawn_bundled_infer_model # must be imported at here, or it will cause fairseq crash on training
27+
2728
self.model = spawn_bundled_infer_model(self.device)
2829

2930
def compute_f0(

rvc/layers/encoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def __init__(
192192
def __call__(
193193
self, x: torch.Tensor, x_lengths: torch.Tensor, g: Optional[torch.Tensor] = None
194194
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
195-
super().__call__(x, x_lengths, g=g)
195+
return super().__call__(x, x_lengths, g=g)
196196

197197
def forward(
198198
self, x: torch.Tensor, x_lengths: torch.Tensor, g: Optional[torch.Tensor] = None

rvc/layers/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def slice_on_last_dim(
2020
start_indices: List[int],
2121
segment_size=4,
2222
) -> torch.Tensor:
23-
new_shape = x.shape
23+
new_shape = [*x.shape]
2424
new_shape[-1] = segment_size
25-
ret = torch.empty(new_shape)
25+
ret = torch.empty(new_shape, device=x.device)
2626
for i in range(x.size(0)):
2727
idx_str = start_indices[i]
2828
idx_end = idx_str + segment_size

0 commit comments

Comments
 (0)