Skip to content
Draft
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
2 changes: 1 addition & 1 deletion configs/acoustic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ backbone_args:
kernel_size: 31
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'
main_loss_type: l2
main_loss_log_norm: false
schedule_type: 'linear'
Expand Down
5 changes: 5 additions & 0 deletions configs/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ pl_trainer_strategy:
find_unused_parameters: false
nccl_p2p: true

###########
# fusing
###########
use_fused_kernels: false

###########
# finetune
###########
Expand Down
2 changes: 1 addition & 1 deletion configs/templates/config_acoustic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ backbone_args:
kernel_size: 31
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'
shallow_diffusion_args:
train_aux_decoder: true
train_diffusion: true
Expand Down
4 changes: 2 additions & 2 deletions configs/templates/config_duration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pitch_prediction_args:
num_channels: 512
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

variances_prediction_args:
total_repeat_bins: 72
Expand All @@ -113,7 +113,7 @@ variances_prediction_args:
num_channels: 384
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

lambda_dur_loss: 1.0
lambda_pitch_loss: 1.0
Expand Down
4 changes: 2 additions & 2 deletions configs/templates/config_variance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pitch_prediction_args:
num_channels: 512
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

variances_prediction_args:
total_repeat_bins: 72
Expand All @@ -113,7 +113,7 @@ variances_prediction_args:
num_channels: 384
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

lambda_dur_loss: 1.0
lambda_pitch_loss: 1.0
Expand Down
4 changes: 2 additions & 2 deletions configs/variance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pitch_prediction_args:
num_channels: 512
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

energy_db_min: -96.0
energy_db_max: -12.0
Expand All @@ -99,7 +99,7 @@ variances_prediction_args:
num_channels: 384
dropout_rate: 0.0
use_conditioner_cache: true
glu_type: 'atanglu'
glu_type: 'softsign_glu'

lambda_dur_loss: 1.0
lambda_pitch_loss: 1.0
Expand Down
4 changes: 3 additions & 1 deletion modules/backbones/lynxnet2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import torch.nn as nn
import torch.nn.functional as F

from modules.commons.common_layers import SinusoidalPosEmb, SwiGLU, ATanGLU, Transpose, AdamWLinear
from modules.commons.common_layers import SinusoidalPosEmb, SwiGLU, ATanGLU, SoftSignGLU, Transpose, AdamWLinear
from utils.hparams import hparams


Expand All @@ -14,6 +14,8 @@ def __init__(self, dim, expansion_factor, kernel_size=31, dropout=0., glu_type='
_glu = SwiGLU()
elif glu_type == 'atanglu':
_glu = ATanGLU()
elif glu_type == 'softsign_glu':
_glu = SoftSignGLU()
else:
raise ValueError(f'{glu_type} is not a valid activation')
if float(dropout) > 0.:
Expand Down
15 changes: 15 additions & 0 deletions modules/commons/common_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ def forward(self, x):
return out * torch.atan(gate)


class SoftSignGLU(nn.Module):
"""Gated Linear Unit with SoftSign gate: out * softsign(gate).

More numerically stable than ATanGLU (no approximation needed in
Triton kernels) while providing similar gating behavior.
"""
def __init__(self, dim=-1):
super().__init__()
self.dim = dim

def forward(self, x):
out, gate = torch.split(x, x.size(self.dim) // 2, dim=self.dim)
return out * torch.nn.functional.softsign(gate)


class AdamWConv1d(torch.nn.Conv1d):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions modules/kernels/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Fused kernels for LYNXNet2 optimization
Loading