so_vits_svc_fork.modules package¶
Subpackages¶
Submodules¶
so_vits_svc_fork.modules.attentions module¶
- class so_vits_svc_fork.modules.attentions.Decoder(hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0.0, proximal_bias=False, proximal_init=True, **kwargs)[source]¶
Bases:
Module
- class so_vits_svc_fork.modules.attentions.Encoder(hidden_channels, filter_channels, n_heads, n_layers, kernel_size=1, p_dropout=0.0, window_size=4, **kwargs)[source]¶
Bases:
Module- forward(x, x_mask)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.attentions.FFN(in_channels, out_channels, filter_channels, kernel_size, p_dropout=0.0, activation=None, causal=False)[source]¶
Bases:
Module- forward(x, x_mask)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.attentions.FFT(hidden_channels, filter_channels, n_heads, n_layers=1, kernel_size=1, p_dropout=0.0, proximal_bias=False, proximal_init=True, **kwargs)[source]¶
Bases:
Module
- class so_vits_svc_fork.modules.attentions.MultiHeadAttention(channels, out_channels, n_heads, p_dropout=0.0, window_size=None, heads_share=True, block_length=None, proximal_bias=False, proximal_init=False)[source]¶
Bases:
Module- forward(x, c, attn_mask=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
so_vits_svc_fork.modules.commons module¶
- so_vits_svc_fork.modules.commons.rand_slice_segments_with_pitch(x: Tensor, f0: Tensor, x_lengths: Tensor | int | None, segment_size: int | None)[source]¶
- so_vits_svc_fork.modules.commons.slice_1d_segments(x: Tensor, starts: Tensor, length: int) Tensor[source]¶
- so_vits_svc_fork.modules.commons.slice_2d_segments(x: Tensor, starts: Tensor, length: int) Tensor[source]¶
so_vits_svc_fork.modules.descriminators module¶
- class so_vits_svc_fork.modules.descriminators.DiscriminatorP(period, kernel_size=5, stride=3, use_spectral_norm=False)[source]¶
Bases:
Module- forward(x)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.descriminators.DiscriminatorS(use_spectral_norm=False)[source]¶
Bases:
Module- forward(x)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.descriminators.MultiPeriodDiscriminator(use_spectral_norm=False)[source]¶
Bases:
Module- forward(y, y_hat)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.descriminators.MultiScaleDiscriminator[source]¶
Bases:
Module- forward(y, y_hat)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
so_vits_svc_fork.modules.encoders module¶
- class so_vits_svc_fork.modules.encoders.Encoder(in_channels, out_channels, hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=0)[source]¶
Bases:
Module- forward(x, x_lengths, g=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.encoders.SpeakerEncoder(mel_n_channels=80, model_num_layers=3, model_hidden_size=256, model_embedding_size=256)[source]¶
Bases:
Module- forward(mels)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.encoders.TextEncoder(out_channels, hidden_channels, kernel_size, n_layers, gin_channels=0, filter_channels=None, n_heads=None, p_dropout=None)[source]¶
Bases:
Module- forward(x, x_mask, f0=None, noice_scale=1)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
so_vits_svc_fork.modules.flows module¶
- class so_vits_svc_fork.modules.flows.ResidualCouplingBlock(channels, hidden_channels, kernel_size, dilation_rate, n_layers, n_flows=4, gin_channels=0)[source]¶
Bases:
Module- forward(x, x_mask, g=None, reverse=False)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
so_vits_svc_fork.modules.losses module¶
so_vits_svc_fork.modules.mel_processing module¶
from logging import getLogger
import torch import torch.utils.data import torchaudio
LOG = getLogger(__name__)
from ..hparams import HParams
- def spectrogram_torch(audio: torch.Tensor, hps: HParams) -> torch.Tensor:
- return torchaudio.transforms.Spectrogram(
n_fft=hps.data.filter_length, win_length=hps.data.win_length, hop_length=hps.data.hop_length, power=1.0, window_fn=torch.hann_window, normalized=False,
).to(audio.device)(audio)
- def spec_to_mel_torch(spec: torch.Tensor, hps: HParams) -> torch.Tensor:
- return torchaudio.transforms.MelScale(
n_mels=hps.data.n_mel_channels, sample_rate=hps.data.sampling_rate, f_min=hps.data.mel_fmin, f_max=hps.data.mel_fmax,
).to(spec.device)(spec)
- def mel_spectrogram_torch(audio: torch.Tensor, hps: HParams) -> torch.Tensor:
- return torchaudio.transforms.MelSpectrogram(
sample_rate=hps.data.sampling_rate, n_fft=hps.data.filter_length, n_mels=hps.data.n_mel_channels, win_length=hps.data.win_length, hop_length=hps.data.hop_length, f_min=hps.data.mel_fmin, f_max=hps.data.mel_fmax, power=1.0, window_fn=torch.hann_window, normalized=False,
).to(audio.device)(audio)
- so_vits_svc_fork.modules.mel_processing.dynamic_range_compression_torch(x, C=1, clip_val=1e-05)[source]¶
PARAMS¶
C: compression factor
so_vits_svc_fork.modules.modules module¶
- class so_vits_svc_fork.modules.modules.ConvReluNorm(in_channels, hidden_channels, out_channels, kernel_size, n_layers, p_dropout)[source]¶
Bases:
Module- forward(x, x_mask)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.DDSConv(channels, kernel_size, n_layers, p_dropout=0.0)[source]¶
Bases:
ModuleDialted and Depth-Separable Convolution
- forward(x, x_mask, g=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.ElementwiseAffine(channels)[source]¶
Bases:
Module- forward(x, x_mask, reverse=False, **kwargs)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.Flip(*args: Any, **kwargs: Any)[source]¶
Bases:
Module- forward(x, *args, reverse=False, **kwargs)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.LayerNorm(channels, eps=1e-05)[source]¶
Bases:
Module- forward(x)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.Log(*args: Any, **kwargs: Any)[source]¶
Bases:
Module- forward(x, x_mask, reverse=False, **kwargs)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.ResBlock1(channels, kernel_size=3, dilation=(1, 3, 5))[source]¶
Bases:
Module- forward(x, x_mask=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.ResBlock2(channels, kernel_size=3, dilation=(1, 3))[source]¶
Bases:
Module- forward(x, x_mask=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.ResidualCouplingLayer(channels, hidden_channels, kernel_size, dilation_rate, n_layers, p_dropout=0, gin_channels=0, mean_only=False)[source]¶
Bases:
Module- forward(x, x_mask, g=None, reverse=False)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class so_vits_svc_fork.modules.modules.WN(hidden_channels, kernel_size, dilation_rate, n_layers, gin_channels=0, p_dropout=0)[source]¶
Bases:
Module- forward(x, x_mask, g=None, **kwargs)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
so_vits_svc_fork.modules.synthesizers module¶
- class so_vits_svc_fork.modules.synthesizers.SynthesizerTrn(spec_channels: int, segment_size: int, inter_channels: int, hidden_channels: int, filter_channels: int, n_heads: int, n_layers: int, kernel_size: int, p_dropout: int, resblock: str, resblock_kernel_sizes: Sequence[int], resblock_dilation_sizes: Sequence[Sequence[int]], upsample_rates: Sequence[int], upsample_initial_channel: int, upsample_kernel_sizes: Sequence[int], gin_channels: int, ssl_dim: int, n_speakers: int, sampling_rate: int = 44100, type_: Literal['hifi-gan', 'istft', 'ms-istft', 'mb-istft'] = 'hifi-gan', gen_istft_n_fft: int = 16, gen_istft_hop_size: int = 4, subbands: int = 4, **kwargs: Any)[source]¶
Bases:
ModuleSynthesizer for Training
- forward(c, f0, uv, spec, g=None, c_lengths=None, spec_lengths=None)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.