Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli/paraformer] ali-paraformer inference #2067

Merged
merged 21 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint
  • Loading branch information
Mddct committed Oct 20, 2023
commit 6967ef58c2a50a5bc0aec90351370f79552cfa21
5 changes: 2 additions & 3 deletions wenet/paraformer/experiment/lfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ def forward(self, input: torch.Tensor,
device=input.device,
dtype=input_lens.dtype).unsqueeze(0).repeat(
B, 1) # [B, T_all_max]
index_mask = (index <
(self.left_padding_nums + input_lens).unsqueeze(1)
) #[B, T_all_max]
# [B, T_all_max]
index_mask = index < (self.left_padding_nums + input_lens).unsqueeze(1)

tail_index_mask = torch.logical_not(
index >= (T_all.unsqueeze(1))) & index_mask
Expand Down
8 changes: 5 additions & 3 deletions wenet/paraformer/experiment/paraformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import torch
import torchaudio
import torchaudio.compliance.kaldi as kaldi
from torch.nn import TransformerDecoder
import yaml
from wenet.cif.predictor import Predictor, cif
from wenet.paraformer.experiment.attention import DummyMultiHeadSANM, MultiHeadAttentionCross, MultiHeadedAttentionSANM
from wenet.paraformer.experiment.attention import (DummyMultiHeadSANM,
MultiHeadAttentionCross,
MultiHeadedAttentionSANM)
from wenet.paraformer.experiment.lfr import LFR
from wenet.paraformer.experiment.positionwise_feed_forward import PositionwiseFeedForwardDecoderSANM
from wenet.paraformer.experiment.positionwise_feed_forward import \
PositionwiseFeedForwardDecoderSANM
from wenet.transformer.encoder import BaseEncoder
from wenet.transformer.cmvn import GlobalCMVN
from wenet.transformer.decoder import TransformerDecoder
Expand Down
Loading