From 425e274c82029217623b263944aaa2b407ef5847 Mon Sep 17 00:00:00 2001 From: Daniel Povey Date: Thu, 10 Mar 2022 16:01:53 +0800 Subject: [PATCH] Replace norm in ConvolutionModule with a scaling factor. --- egs/librispeech/ASR/transducer_stateless/conformer.py | 5 +++-- egs/librispeech/ASR/transducer_stateless/train.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/egs/librispeech/ASR/transducer_stateless/conformer.py b/egs/librispeech/ASR/transducer_stateless/conformer.py index acaf064b3..4cf66e2fe 100644 --- a/egs/librispeech/ASR/transducer_stateless/conformer.py +++ b/egs/librispeech/ASR/transducer_stateless/conformer.py @@ -857,7 +857,8 @@ class ConvolutionModule(nn.Module): bias=bias, ) - self.norm = nn.LayerNorm(channels) + self.scale = ExpScale(1, speed=10.0, initial_scale=1.0) + # shape: (channels, 1), broadcasts with (batch, channel, time). self.activation = SwishOffset() @@ -891,7 +892,7 @@ class ConvolutionModule(nn.Module): x = self.depthwise_conv(x) # x is (batch, channels, time) x = x.permute(0, 2, 1) - x = self.norm(x) + x = self.scale(x) x = x.permute(0, 2, 1) x = self.activation(x) diff --git a/egs/librispeech/ASR/transducer_stateless/train.py b/egs/librispeech/ASR/transducer_stateless/train.py index 4fd4bf764..c355c7ad3 100755 --- a/egs/librispeech/ASR/transducer_stateless/train.py +++ b/egs/librispeech/ASR/transducer_stateless/train.py @@ -110,7 +110,7 @@ def get_parser(): parser.add_argument( "--exp-dir", type=str, - default="transducer_stateless/specaugmod_baseline_randcombine1_expscale3_brelu2swish2_0.1_bnorm", + default="transducer_stateless/specaugmod_baseline_randcombine1_expscale3_brelu2swish2_0.1_bnorm2", help="""The experiment dir. It specifies the directory where all training related files, e.g., checkpoints, log, etc, are saved