From 90fb9207bac0e90487b0011f1765ab1b118df6bb Mon Sep 17 00:00:00 2001 From: jianyou Date: Mon, 31 Mar 2025 18:02:02 +0800 Subject: [PATCH 1/2] potential fix to k2SSL hubert_ce encoder forward function --- egs/librispeech/SSL/zipformer/hubert_ce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egs/librispeech/SSL/zipformer/hubert_ce.py b/egs/librispeech/SSL/zipformer/hubert_ce.py index 1ac368a1d..1d9fd31f9 100644 --- a/egs/librispeech/SSL/zipformer/hubert_ce.py +++ b/egs/librispeech/SSL/zipformer/hubert_ce.py @@ -429,7 +429,7 @@ class HubertModel(nn.Module): # padding_mask: (B, T), bool # mask_indices: (B, T), bool x = x.transpose(0, 1) - x, x_lens = self.encoder(x, (~padding_mask).sum(dim=-1)) + x, x_lens = self.encoder(x, (~padding_mask).sum(dim=-1) if padding_mask else None) x = x.transpose(0, 1) if features_only: From b4c9e37c8e7e15ef14546b3f38debb8b3dfa6933 Mon Sep 17 00:00:00 2001 From: jianyou Date: Tue, 1 Apr 2025 14:27:00 +0800 Subject: [PATCH 2/2] fix --- egs/librispeech/SSL/zipformer/hubert_ce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egs/librispeech/SSL/zipformer/hubert_ce.py b/egs/librispeech/SSL/zipformer/hubert_ce.py index 1d9fd31f9..4a6b770df 100644 --- a/egs/librispeech/SSL/zipformer/hubert_ce.py +++ b/egs/librispeech/SSL/zipformer/hubert_ce.py @@ -429,7 +429,7 @@ class HubertModel(nn.Module): # padding_mask: (B, T), bool # mask_indices: (B, T), bool x = x.transpose(0, 1) - x, x_lens = self.encoder(x, (~padding_mask).sum(dim=-1) if padding_mask else None) + x, x_lens = self.encoder(x, (~padding_mask).sum(dim=-1) if padding_mask is not None else None) x = x.transpose(0, 1) if features_only: