From 353469182c732d63efbe02c93e8f2408ea11c2e1 Mon Sep 17 00:00:00 2001 From: Zengwei Yao Date: Thu, 21 Mar 2024 15:59:43 +0800 Subject: [PATCH] fix issue in zipformer.py (#1566) --- egs/librispeech/ASR/zipformer/zipformer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egs/librispeech/ASR/zipformer/zipformer.py b/egs/librispeech/ASR/zipformer/zipformer.py index 61ae378d8..17a3f8719 100644 --- a/egs/librispeech/ASR/zipformer/zipformer.py +++ b/egs/librispeech/ASR/zipformer/zipformer.py @@ -788,7 +788,7 @@ class Zipformer2EncoderLayer(nn.Module): selected_attn_weights = attn_weights[0:1] if torch.jit.is_scripting() or torch.jit.is_tracing(): pass - elif not self.training and random.random() < float(self.const_attention_rate): + elif self.training and random.random() < float(self.const_attention_rate): # Make attention weights constant. The intention is to # encourage these modules to do something similar to an # averaging-over-time operation.