Skip to content

Commit b748531

Browse files
committed
5 layers
1 parent 1622a77 commit b748531

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

config/maxgan.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ audio:
2626
mel_fmax: 8000.0
2727
#############################
2828
gen:
29-
upsample_rates: [10,4,2,2]
30-
upsample_kernel_sizes: [16,16,4,4]
31-
upsample_initial_channel: 384
29+
upsample_rates: [5,4,2,2,2]
30+
upsample_kernel_sizes: [15,12,4,4,4]
31+
upsample_initial_channel: 512
3232
resblock_kernel_sizes: [3,7,11]
3333
resblock_dilation_sizes: [[1,3,5], [1,3,5], [1,3,5]]
3434
#############################

model/generator.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from torch.nn.utils import remove_weight_norm
99

1010
from .nsf import SourceModuleHnNSF
11-
from .bigv import init_weights, AMPBlock
11+
from .bigv import init_weights, SnakeBeta, AMPBlock
12+
from .alias import Activation1d
1213

1314

1415
class SpeakerAdapter(nn.Module):
@@ -72,6 +73,7 @@ def __init__(self, hp):
7273
# spk
7374
self.adapter.append(SpeakerAdapter(
7475
256, hp.gen.upsample_initial_channel // (2 ** (i + 1))))
76+
# print(f'ups: {i} {k}, {u}, {(k - u) // 2}')
7577
# base
7678
self.ups.append(nn.ModuleList([
7779
weight_norm(ConvTranspose1d(hp.gen.upsample_initial_channel // (2 ** i),
@@ -106,6 +108,8 @@ def __init__(self, hp):
106108
self.resblocks.append(AMPBlock(hp, ch, k, d))
107109

108110
# post conv
111+
activation_post = SnakeBeta(ch, alpha_logscale=True)
112+
self.activation_post = Activation1d(activation=activation_post)
109113
self.conv_post = weight_norm(Conv1d(ch, 1, 7, 1, padding=3))
110114

111115
# weight initialization
@@ -120,6 +124,7 @@ def forward(self, spk, x, pos, f0):
120124
har_source = self.m_source(f0)
121125
har_source = har_source.transpose(1, 2)
122126
# pre conv
127+
# x = x + torch.randn_like(x) # for last train
123128
x = self.cond_pre(x) # [B, L, D]
124129
p = self.cond_pos(pos)
125130
x = x + p
@@ -145,7 +150,7 @@ def forward(self, spk, x, pos, f0):
145150
x = xs / self.num_kernels
146151

147152
# post conv
148-
x = nn.functional.leaky_relu(x)
153+
x = self.activation_post(x)
149154
x = self.conv_post(x)
150155
x = torch.tanh(x)
151156
return x

utils/train.py

+3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ def train(rank, args, chkpt_path, hp, hp_str):
142142

143143
score_loss = score_loss / len(res_fake + period_fake)
144144

145+
# for fast train
145146
loss_g = score_loss + stft_loss + mel_loss
147+
# for last train
148+
# loss_g = score_loss + stft_loss
146149

147150
loss_g.backward()
148151
optim_g.step()

0 commit comments

Comments
 (0)