From a3a69e8bd598d0cf97e643f0161728a47e3c9356 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 00:37:50 +0800 Subject: [PATCH] chore(format): run black on dev (#144) Co-authored-by: github-actions[bot] --- infer/modules/train/train.py | 2 +- rvc/layers/encoders.py | 1 + rvc/layers/norms.py | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/infer/modules/train/train.py b/infer/modules/train/train.py index 42d525a..5c4bd0c 100644 --- a/infer/modules/train/train.py +++ b/infer/modules/train/train.py @@ -32,7 +32,7 @@ try: except Exception: pass finally: - if not ('GradScaler' in globals() and 'autocast' in globals()): + if not ("GradScaler" in globals() and "autocast" in globals()): from torch.amp.grad_scaler import GradScaler from torch.amp.autocast_mode import autocast diff --git a/rvc/layers/encoders.py b/rvc/layers/encoders.py index 2a6db19..9a3e307 100644 --- a/rvc/layers/encoders.py +++ b/rvc/layers/encoders.py @@ -213,6 +213,7 @@ class PosteriorEncoder(nn.Module): def __prepare_scriptable__(self): from torch.nn.utils import parametrize + if parametrize.is_parametrized(self.enc, "weight"): parametrize.remove_parametrizations(self.enc, "weight") return self diff --git a/rvc/layers/norms.py b/rvc/layers/norms.py index 0512d6d..68ccdea 100644 --- a/rvc/layers/norms.py +++ b/rvc/layers/norms.py @@ -51,7 +51,9 @@ class WN(torch.nn.Module): cond_layer = torch.nn.Conv1d( gin_channels, 2 * hidden_channels * n_layers, 1 ) - self.cond_layer = torch.nn.utils.parametrizations.weight_norm(cond_layer, name="weight") + self.cond_layer = torch.nn.utils.parametrizations.weight_norm( + cond_layer, name="weight" + ) for i in range(n_layers): dilation = dilation_rate**i @@ -63,7 +65,9 @@ class WN(torch.nn.Module): dilation=dilation, padding=padding, ) - in_layer = torch.nn.utils.parametrizations.weight_norm(in_layer, name="weight") + in_layer = torch.nn.utils.parametrizations.weight_norm( + in_layer, name="weight" + ) self.in_layers.append(in_layer) # last one is not necessary @@ -73,7 +77,9 @@ class WN(torch.nn.Module): res_skip_channels = hidden_channels res_skip_layer = torch.nn.Conv1d(hidden_channels, res_skip_channels, 1) - res_skip_layer = torch.nn.utils.parametrizations.weight_norm(res_skip_layer, name="weight") + res_skip_layer = torch.nn.utils.parametrizations.weight_norm( + res_skip_layer, name="weight" + ) self.res_skip_layers.append(res_skip_layer) def __call__(