Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(format): run black on main #942

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rvc/infer/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ def convert_audio(
print(f"Converted audio chunk {len(converted_chunks)}")

if split_audio:
audio_opt = merge_audio(chunks, converted_chunks, intervals, 16000, self.tgt_sr)
audio_opt = merge_audio(
chunks, converted_chunks, intervals, 16000, self.tgt_sr
)
else:
audio_opt = converted_chunks[0]

Expand Down
25 changes: 13 additions & 12 deletions rvc/lib/algorithm/generators/refinegan.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ def __init__(
self.dim = self.harmonic_num + 1
self.sampling_rate = samp_rate
self.voiced_threshold = voiced_threshold

self.merge = nn.Sequential(
nn.Linear(self.dim, 1, bias=False),
nn.Tanh(),
)
)

def _f02uv(self, f0):
# generate uv signal
Expand Down Expand Up @@ -275,11 +275,12 @@ def forward(self, f0):
noise = noise_amp * torch.randn_like(sine_waves)

sine_waves = sine_waves * uv + noise
# correct DC offset
# correct DC offset
sine_waves = sine_waves - sine_waves.mean(dim=1, keepdim=True)
# merge with grad
# merge with grad
return self.merge(sine_waves)



class RefineGANGenerator(nn.Module):
"""
RefineGAN generator for audio synthesis.
Expand Down Expand Up @@ -309,7 +310,7 @@ def __init__(
num_mels: int = 128,
start_channels: int = 16,
gin_channels: int = 256,
checkpointing: bool =False,
checkpointing: bool = False,
):
super().__init__()
self.downsample_rates = downsample_rates
Expand All @@ -328,7 +329,7 @@ def __init__(
kernel_size=7,
stride=1,
padding=3,
bias=False
bias=False,
)
)

Expand Down Expand Up @@ -373,9 +374,7 @@ def __init__(
for rate in upsample_rates:
new_channels = channels // 2

self.upsample_blocks.append(
nn.Upsample(scale_factor=rate, mode="linear")
)
self.upsample_blocks.append(nn.Upsample(scale_factor=rate, mode="linear"))

self.upsample_conv_blocks.append(
ParallelResBlock(
Expand All @@ -400,8 +399,10 @@ def __init__(
)

def forward(self, mel: torch.Tensor, f0: torch.Tensor, g: torch.Tensor = None):

f0 = F.interpolate(f0.unsqueeze(1), size=mel.shape[-1] * self.upp, mode="linear")

f0 = F.interpolate(
f0.unsqueeze(1), size=mel.shape[-1] * self.upp, mode="linear"
)
har_source = self.m_source(f0.transpose(1, 2)).transpose(1, 2)

# expanding pitch source to 16 channels
Expand Down