fix dur
This commit is contained in:
42
models.py
42
models.py
@@ -26,18 +26,18 @@ class DurationDiscriminator(nn.Module): #vits2
|
|||||||
|
|
||||||
self.drop = nn.Dropout(p_dropout)
|
self.drop = nn.Dropout(p_dropout)
|
||||||
self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
self.conv_1 = nn.Conv1d(in_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
||||||
self.norm_1 = modules.LayerNorm(filter_channels)
|
#self.norm_1 = modules.LayerNorm(filter_channels)
|
||||||
self.conv_2 = nn.Conv1d(filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
self.conv_2 = nn.Conv1d(filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
||||||
self.norm_2 = modules.LayerNorm(filter_channels)
|
#self.norm_2 = modules.LayerNorm(filter_channels)
|
||||||
self.dur_proj = nn.Conv1d(1, filter_channels, 1)
|
self.dur_proj = nn.Conv1d(1, filter_channels, 1)
|
||||||
|
|
||||||
self.pre_out_conv_1 = nn.Conv1d(2*filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
self.pre_out_conv_1 = nn.Conv1d(2*filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
||||||
self.pre_out_norm_1 = modules.LayerNorm(filter_channels)
|
#self.pre_out_norm_1 = modules.LayerNorm(filter_channels)
|
||||||
self.pre_out_conv_2 = nn.Conv1d(filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
self.pre_out_conv_2 = nn.Conv1d(filter_channels, filter_channels, kernel_size, padding=kernel_size//2)
|
||||||
self.pre_out_norm_2 = modules.LayerNorm(filter_channels)
|
#self.pre_out_norm_2 = modules.LayerNorm(filter_channels)
|
||||||
|
|
||||||
if gin_channels != 0:
|
#if gin_channels != 0:
|
||||||
self.cond = nn.Conv1d(gin_channels, in_channels, 1)
|
# self.cond = nn.Conv1d(gin_channels, in_channels, 1)
|
||||||
|
|
||||||
self.output_layer = nn.Sequential(
|
self.output_layer = nn.Sequential(
|
||||||
nn.Linear(filter_channels, 1),
|
nn.Linear(filter_channels, 1),
|
||||||
@@ -48,13 +48,13 @@ class DurationDiscriminator(nn.Module): #vits2
|
|||||||
dur = self.dur_proj(dur)
|
dur = self.dur_proj(dur)
|
||||||
x = torch.cat([x, dur], dim=1)
|
x = torch.cat([x, dur], dim=1)
|
||||||
x = self.pre_out_conv_1(x * x_mask)
|
x = self.pre_out_conv_1(x * x_mask)
|
||||||
x = torch.relu(x)
|
#x = torch.relu(x)
|
||||||
x = self.pre_out_norm_1(x)
|
#x = self.pre_out_norm_1(x)
|
||||||
x = self.drop(x)
|
#x = self.drop(x)
|
||||||
x = self.pre_out_conv_2(x * x_mask)
|
x = self.pre_out_conv_2(x * x_mask)
|
||||||
x = torch.relu(x)
|
#x = torch.relu(x)
|
||||||
x = self.pre_out_norm_2(x)
|
#x = self.pre_out_norm_2(x)
|
||||||
x = self.drop(x)
|
#x = self.drop(x)
|
||||||
x = x * x_mask
|
x = x * x_mask
|
||||||
x = x.transpose(1, 2)
|
x = x.transpose(1, 2)
|
||||||
output_prob = self.output_layer(x)
|
output_prob = self.output_layer(x)
|
||||||
@@ -62,17 +62,17 @@ class DurationDiscriminator(nn.Module): #vits2
|
|||||||
|
|
||||||
def forward(self, x, x_mask, dur_r, dur_hat, g=None):
|
def forward(self, x, x_mask, dur_r, dur_hat, g=None):
|
||||||
x = torch.detach(x)
|
x = torch.detach(x)
|
||||||
if g is not None:
|
#if g is not None:
|
||||||
g = torch.detach(g)
|
# g = torch.detach(g)
|
||||||
x = x + self.cond(g)
|
# x = x + self.cond(g)
|
||||||
x = self.conv_1(x * x_mask)
|
x = self.conv_1(x * x_mask)
|
||||||
x = torch.relu(x)
|
#x = torch.relu(x)
|
||||||
x = self.norm_1(x)
|
#x = self.norm_1(x)
|
||||||
x = self.drop(x)
|
#x = self.drop(x)
|
||||||
x = self.conv_2(x * x_mask)
|
x = self.conv_2(x * x_mask)
|
||||||
x = torch.relu(x)
|
#x = torch.relu(x)
|
||||||
x = self.norm_2(x)
|
#x = self.norm_2(x)
|
||||||
x = self.drop(x)
|
#x = self.drop(x)
|
||||||
|
|
||||||
output_probs = []
|
output_probs = []
|
||||||
for dur in [dur_r, dur_hat]:
|
for dur in [dur_r, dur_hat]:
|
||||||
|
|||||||
Reference in New Issue
Block a user