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

Eval mode for ASR model and compatibility with PyTorch > 1.7 #86

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions Utils/ASR/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def forward(self, x):
return x

class CausualBlock(nn.Module):
def __init__(self, hidden_dim, n_conv=3, dropout_p=0.2, activ='lrelu'):
def __init__(self, hidden_dim, n_conv=3, dropout_p=0.0, activ='lrelu'):
super(CausualBlock, self).__init__()
self.blocks = nn.ModuleList([
self._get_conv(hidden_dim, dilation=3**i, activ=activ, dropout_p=dropout_p)
Expand All @@ -87,10 +87,10 @@ def forward(self, x):
for block in self.blocks:
res = x
x = block(x)
x += res
x = x + res
return x

def _get_conv(self, hidden_dim, dilation, activ='lrelu', dropout_p=0.2):
def _get_conv(self, hidden_dim, dilation, activ='lrelu', dropout_p=0.0):
layers = [
CausualConv(hidden_dim, hidden_dim, kernel_size=3, padding=dilation, dilation=dilation),
_get_activation_fn(activ),
Expand All @@ -103,7 +103,7 @@ def _get_conv(self, hidden_dim, dilation, activ='lrelu', dropout_p=0.2):
return nn.Sequential(*layers)

class ConvBlock(nn.Module):
def __init__(self, hidden_dim, n_conv=3, dropout_p=0.2, activ='relu'):
def __init__(self, hidden_dim, n_conv=3, dropout_p=0.0, activ='relu'):
super().__init__()
self._n_groups = 8
self.blocks = nn.ModuleList([
Expand All @@ -115,10 +115,10 @@ def forward(self, x):
for block in self.blocks:
res = x
x = block(x)
x += res
x = x + res
return x

def _get_conv(self, hidden_dim, dilation, activ='relu', dropout_p=0.2):
def _get_conv(self, hidden_dim, dilation, activ='relu', dropout_p=0.0):
layers = [
ConvNorm(hidden_dim, hidden_dim, kernel_size=3, padding=dilation, dilation=dilation),
_get_activation_fn(activ),
Expand Down