mirror of
https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-06-05 09:10:25 +08:00
chore(format): run black on dev (#11)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b91dcf2261
commit
26dc9ba98d
@@ -355,9 +355,7 @@ class GeneratorNSF(torch.nn.Module):
|
|||||||
self.num_upsamples = len(upsample_rates)
|
self.num_upsamples = len(upsample_rates)
|
||||||
|
|
||||||
self.f0_upsamp = torch.nn.Upsample(scale_factor=math.prod(upsample_rates))
|
self.f0_upsamp = torch.nn.Upsample(scale_factor=math.prod(upsample_rates))
|
||||||
self.m_source = SourceModuleHnNSF(
|
self.m_source = SourceModuleHnNSF(sampling_rate=sr, harmonic_num=0)
|
||||||
sampling_rate=sr, harmonic_num=0
|
|
||||||
)
|
|
||||||
self.noise_convs = nn.ModuleList()
|
self.noise_convs = nn.ModuleList()
|
||||||
self.conv_pre = Conv1d(
|
self.conv_pre = Conv1d(
|
||||||
initial_channel, upsample_initial_channel, 7, 1, padding=3
|
initial_channel, upsample_initial_channel, 7, 1, padding=3
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class FFN(nn.Module):
|
|||||||
|
|
||||||
x = self.conv_2(self._padding(x, x_mask))
|
x = self.conv_2(self._padding(x, x_mask))
|
||||||
return x * x_mask
|
return x * x_mask
|
||||||
|
|
||||||
def _padding(self, x: torch.Tensor, x_mask: torch.Tensor) -> torch.Tensor:
|
def _padding(self, x: torch.Tensor, x_mask: torch.Tensor) -> torch.Tensor:
|
||||||
if self.causal:
|
if self.causal:
|
||||||
return self._causal_padding(x * x_mask)
|
return self._causal_padding(x * x_mask)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from torch.nn import functional as F
|
|||||||
|
|
||||||
from .utils import activate_add_tanh_sigmoid_multiply
|
from .utils import activate_add_tanh_sigmoid_multiply
|
||||||
|
|
||||||
|
|
||||||
class LayerNorm(nn.Module):
|
class LayerNorm(nn.Module):
|
||||||
def __init__(self, channels: int, eps: float = 1e-5):
|
def __init__(self, channels: int, eps: float = 1e-5):
|
||||||
super(LayerNorm, self).__init__()
|
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)
|
x = F.layer_norm(x, (self.channels,), self.gamma, self.beta, self.eps)
|
||||||
return x.transpose(1, -1)
|
return x.transpose(1, -1)
|
||||||
|
|
||||||
|
|
||||||
class WN(torch.nn.Module):
|
class WN(torch.nn.Module):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ class DioF0Predictor(F0Predictor):
|
|||||||
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
|
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)
|
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
|
||||||
|
|
||||||
def compute_f0(
|
def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None):
|
||||||
self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None
|
|
||||||
):
|
|
||||||
if p_len is None:
|
if p_len is None:
|
||||||
p_len = wav.shape[0] // self.hop_length
|
p_len = wav.shape[0] // self.hop_length
|
||||||
f0, t = pyworld.dio(
|
f0, t = pyworld.dio(
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ class HarvestF0Predictor(F0Predictor):
|
|||||||
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
|
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)
|
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
|
||||||
|
|
||||||
def compute_f0(
|
def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None):
|
||||||
self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None
|
|
||||||
):
|
|
||||||
if p_len is None:
|
if p_len is None:
|
||||||
p_len = wav.shape[0] // self.hop_length
|
p_len = wav.shape[0] // self.hop_length
|
||||||
f0, t = pyworld.harvest(
|
f0, t = pyworld.harvest(
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ class PMF0Predictor(F0Predictor):
|
|||||||
def __init__(self, hop_length=512, f0_min=50, f0_max=1100, sampling_rate=44100):
|
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)
|
super().__init__(hop_length, f0_min, f0_max, sampling_rate)
|
||||||
|
|
||||||
def compute_f0(
|
def compute_f0(self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None):
|
||||||
self, wav: np.ndarray[Any, np.dtype], p_len: Optional[int] = None
|
|
||||||
):
|
|
||||||
x = wav
|
x = wav
|
||||||
if p_len is None:
|
if p_len is None:
|
||||||
p_len = x.shape[0] // self.hop_length
|
p_len = x.shape[0] // self.hop_length
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from .utils import (
|
|||||||
|
|
||||||
LRELU_SLOPE = 0.1
|
LRELU_SLOPE = 0.1
|
||||||
|
|
||||||
|
|
||||||
class ResBlock1(torch.nn.Module):
|
class ResBlock1(torch.nn.Module):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -111,6 +112,7 @@ class ResBlock2(torch.nn.Module):
|
|||||||
Actually this module is not used currently
|
Actually this module is not used currently
|
||||||
because all configs specified "resblock": "1"
|
because all configs specified "resblock": "1"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
channels: int,
|
channels: int,
|
||||||
@@ -255,6 +257,7 @@ class ResidualCouplingLayer(nn.Module):
|
|||||||
torch.nn.utils.remove_weight_norm(self.enc)
|
torch.nn.utils.remove_weight_norm(self.enc)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
class ResidualCouplingBlock(nn.Module):
|
class ResidualCouplingBlock(nn.Module):
|
||||||
class Flip(nn.Module):
|
class Flip(nn.Module):
|
||||||
"""
|
"""
|
||||||
@@ -262,6 +265,7 @@ class ResidualCouplingBlock(nn.Module):
|
|||||||
can't take variable number of arguments or
|
can't take variable number of arguments or
|
||||||
use keyword-only arguments with defaults
|
use keyword-only arguments with defaults
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
self,
|
self,
|
||||||
x: torch.Tensor,
|
x: torch.Tensor,
|
||||||
|
|||||||
Reference in New Issue
Block a user