From 26dc9ba98d526e4e8e11a8d434091d4063b87a05 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:46:57 +0900 Subject: [PATCH] chore(format): run black on dev (#11) Co-authored-by: github-actions[bot] --- infer/lib/infer_pack/models.py | 4 +--- rvc/attentions.py | 2 +- rvc/norms.py | 2 ++ rvc/onnx/f0predictors/dio.py | 4 +--- rvc/onnx/f0predictors/harvest.py | 4 +--- rvc/onnx/f0predictors/pm.py | 4 +--- rvc/residuals.py | 4 ++++ 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/infer/lib/infer_pack/models.py b/infer/lib/infer_pack/models.py index f85e356..b923baf 100644 --- a/infer/lib/infer_pack/models.py +++ b/infer/lib/infer_pack/models.py @@ -355,9 +355,7 @@ class GeneratorNSF(torch.nn.Module): self.num_upsamples = len(upsample_rates) self.f0_upsamp = torch.nn.Upsample(scale_factor=math.prod(upsample_rates)) - self.m_source = SourceModuleHnNSF( - sampling_rate=sr, harmonic_num=0 - ) + self.m_source = SourceModuleHnNSF(sampling_rate=sr, harmonic_num=0) self.noise_convs = nn.ModuleList() self.conv_pre = Conv1d( initial_channel, upsample_initial_channel, 7, 1, padding=3 diff --git a/rvc/attentions.py b/rvc/attentions.py index fc79828..0cf6922 100644 --- a/rvc/attentions.py +++ b/rvc/attentions.py @@ -263,7 +263,7 @@ class FFN(nn.Module): x = self.conv_2(self._padding(x, x_mask)) return x * x_mask - + def _padding(self, x: torch.Tensor, x_mask: torch.Tensor) -> torch.Tensor: if self.causal: return self._causal_padding(x * x_mask) diff --git a/rvc/norms.py b/rvc/norms.py index 3463fb2..9418035 100644 --- a/rvc/norms.py +++ b/rvc/norms.py @@ -6,6 +6,7 @@ from torch.nn import functional as F from .utils import activate_add_tanh_sigmoid_multiply + class LayerNorm(nn.Module): def __init__(self, channels: int, eps: float = 1e-5): super(LayerNorm, self).__init__() @@ -20,6 +21,7 @@ class LayerNorm(nn.Module): x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps) return x.transpose(1, -1) + class WN(torch.nn.Module): def __init__( self, diff --git a/rvc/onnx/f0predictors/dio.py b/rvc/onnx/f0predictors/dio.py index 29b1f0f..4437696 100644 --- a/rvc/onnx/f0predictors/dio.py +++ b/rvc/onnx/f0predictors/dio.py @@ -10,9 +10,7 @@ class DioF0Predictor(F0Predictor): def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100): super().__init__(hop_length, f0_min, f0_max, sampling_rate) - def compute_f0( - self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None - ): + def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None): if p_len is None: p_len = wav.shape[0] // self.hop_length f0, t = pyworld.dio( diff --git a/rvc/onnx/f0predictors/harvest.py b/rvc/onnx/f0predictors/harvest.py index bec8a5d..694eb04 100644 --- a/rvc/onnx/f0predictors/harvest.py +++ b/rvc/onnx/f0predictors/harvest.py @@ -10,9 +10,7 @@ class HarvestF0Predictor(F0Predictor): def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100): super().__init__(hop_length, f0_min, f0_max, sampling_rate) - def compute_f0( - self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None - ): + def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None): if p_len is None: p_len = wav.shape[0] // self.hop_length f0, t = pyworld.harvest( diff --git a/rvc/onnx/f0predictors/pm.py b/rvc/onnx/f0predictors/pm.py index ca2790d..39450f1 100644 --- a/rvc/onnx/f0predictors/pm.py +++ b/rvc/onnx/f0predictors/pm.py @@ -10,9 +10,7 @@ class PMF0Predictor(F0Predictor): def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100): super().__init__(hop_length, f0_min, f0_max, sampling_rate) - def compute_f0( - self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None - ): + def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None): x = wav if p_len is None: p_len = x.shape[0] // self.hop_length diff --git a/rvc/residuals.py b/rvc/residuals.py index c0f2752..9daef7e 100644 --- a/rvc/residuals.py +++ b/rvc/residuals.py @@ -14,6 +14,7 @@ from .utils import ( LRELU_SLOPE = 0.1 + class ResBlock1(torch.nn.Module): def __init__( self, @@ -111,6 +112,7 @@ class ResBlock2(torch.nn.Module): Actually this module is not used currently because all configs specified "resblock": "1" """ + def __init__( self, channels: int, @@ -255,6 +257,7 @@ class ResidualCouplingLayer(nn.Module): torch.nn.utils.remove_weight_norm(self.enc) return self + class ResidualCouplingBlock(nn.Module): class Flip(nn.Module): """ @@ -262,6 +265,7 @@ class ResidualCouplingBlock(nn.Module): can't take variable number of arguments or use keyword-only arguments with defaults """ + def forward( self, x: torch.Tensor,