From aff7c4ee3ce687e524961f25349f72c6da4e628d Mon Sep 17 00:00:00 2001 From: yaozengwei Date: Mon, 9 May 2022 16:46:51 +0800 Subject: [PATCH] minor fix of conv-emformer --- .../ASR/conv_emformer_transducer/emformer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/egs/librispeech/ASR/conv_emformer_transducer/emformer.py b/egs/librispeech/ASR/conv_emformer_transducer/emformer.py index 71ddd34cf..fca949e42 100644 --- a/egs/librispeech/ASR/conv_emformer_transducer/emformer.py +++ b/egs/librispeech/ASR/conv_emformer_transducer/emformer.py @@ -552,7 +552,7 @@ class EmformerLayer(nn.Module): max_memory_size: int = 0, tanh_on_mem: bool = False, negative_inf: float = -1e8, - causal: bool = False, + causal: bool = True, ): super().__init__() @@ -1058,7 +1058,7 @@ class EmformerEncoder(nn.Module): max_memory_size: int = 0, tanh_on_mem: bool = False, negative_inf: float = -1e8, - causal: bool = False, + causal: bool = True, ): super().__init__() @@ -1088,6 +1088,8 @@ class EmformerEncoder(nn.Module): ] ) + self.encoder_pos = RelPositionalEncoding(d_model, dropout) + self.left_context_length = left_context_length self.right_context_length = right_context_length self.chunk_length = chunk_length @@ -1384,7 +1386,7 @@ class Emformer(EncoderInterface): max_memory_size: int = 0, tanh_on_mem: bool = False, negative_inf: float = -1e8, - causal: bool = False, + causal: bool = True, ): super().__init__() @@ -1555,7 +1557,7 @@ class ConvolutionModule(nn.Module): channels: int, kernel_size: int, bias: bool = True, - causal: bool = False, + causal: bool = True, ) -> None: """Construct an ConvolutionModule object.""" super(ConvolutionModule, self).__init__()