Skip to content

Commit

Permalink
Merge pull request #899 from IAHispano/formatter/main
Browse files Browse the repository at this point in the history
chore(format): run black on main
  • Loading branch information
blaisewf authored Dec 3, 2024
2 parents 5df0934 + f9b39ea commit 408e006
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
8 changes: 4 additions & 4 deletions rvc/lib/algorithm/attentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ class FFN(torch.nn.Module):

def __init__(
self,
in_channels = int,
out_channels = int,
filter_channels = int,
kernel_size = int,
in_channels=int,
out_channels=int,
filter_channels=int,
kernel_size=int,
p_dropout: float = 0.0,
activation: str = None,
causal: bool = False,
Expand Down
10 changes: 8 additions & 2 deletions rvc/lib/algorithm/discriminators.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DiscriminatorS(torch.nn.Module):
convolutional layers that are applied to the input signal.
"""

def __init__(self, use_spectral_norm: bool =False):
def __init__(self, use_spectral_norm: bool = False):
super(DiscriminatorS, self).__init__()
norm_f = spectral_norm if use_spectral_norm else weight_norm
self.convs = torch.nn.ModuleList(
Expand Down Expand Up @@ -108,7 +108,13 @@ class DiscriminatorP(torch.nn.Module):
use_spectral_norm (bool): Whether to use spectral normalization. Defaults to False.
"""

def __init__(self, period: int, kernel_size: int = 5, stride: int = 3, use_spectral_norm: bool = False):
def __init__(
self,
period: int,
kernel_size: int = 5,
stride: int = 3,
use_spectral_norm: bool = False,
):
super(DiscriminatorP, self).__init__()
self.period = period
norm_f = spectral_norm if use_spectral_norm else weight_norm
Expand Down
2 changes: 1 addition & 1 deletion rvc/lib/algorithm/nsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class GeneratorNSF(torch.nn.Module):

def __init__(
self,
initial_channel : int,
initial_channel: int,
resblock_kernel_sizes: list,
resblock_dilation_sizes: list,
upsample_rates: list,
Expand Down
12 changes: 10 additions & 2 deletions rvc/lib/algorithm/residuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def remove_weight_norm(self):


class ResBlock(ResBlockBase):
def __init__(self, channels: int, kernel_size: int = 3, dilation: Tuple[int] = (1, 3, 5)):
def __init__(
self, channels: int, kernel_size: int = 3, dilation: Tuple[int] = (1, 3, 5)
):
super(ResBlock, self).__init__(channels, kernel_size, dilation)


Expand Down Expand Up @@ -210,7 +212,13 @@ def __init__(
self.post.weight.data.zero_()
self.post.bias.data.zero_()

def forward(self, x: torch.Tensor, x_mask: torch.Tensor, g: Optional[torch.Tensor] = None, reverse: bool = False):
def forward(
self,
x: torch.Tensor,
x_mask: torch.Tensor,
g: Optional[torch.Tensor] = None,
reverse: bool = False,
):
"""Forward pass.
Args:
Expand Down
1 change: 1 addition & 0 deletions rvc/train/losses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import torch


def feature_loss(fmap_r, fmap_g):
"""
Compute the feature loss between reference and generated feature maps.
Expand Down
4 changes: 2 additions & 2 deletions rvc/train/process/change_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import torch


def change_info(path, info, name):
try:
ckpt = torch.load(path, map_location="cpu")
Expand All @@ -15,8 +16,7 @@ def change_info(path, info, name):
torch.save(ckpt, os.path.join(target_dir, f"{name}.pth"))

return "Success."

except Exception as error:
print(f"An error occurred while changing the info: {error}")
return f"Error: {error}"

0 comments on commit 408e006

Please sign in to comment.