fix issue in zipformer.py (#1566)

This commit is contained in:
Zengwei Yao 2024-03-21 15:59:43 +08:00 committed by GitHub
parent bddc3fca7a
commit 353469182c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.