Skip to content

Commit

Permalink
Update subsampling.py (#2554)
Browse files Browse the repository at this point in the history
The StackNFramesSubsampling module was missing the pos_enc attribute, which caused an AttributeError when pos_enc.position_encoding was called in the forward_chunk.
  • Loading branch information
xu-gaopeng authored Jun 13, 2024
1 parent 509d05d commit 7ce2126
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wenet/transformer/subsampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,7 @@ def forward(
x = self.norm(x)
x = self.out(x)
return x, pos_emb, new_mask.unsqueeze(1)

def position_encoding(self, offset: Union[int, torch.Tensor],
size: int) -> torch.Tensor:
return self.pos_enc_class.position_encoding(offset, size)

0 comments on commit 7ce2126

Please sign in to comment.