| File was renamed from funasr/models/branchformer/branchformer_encoder.py |
| | |
| | | |
| | | import numpy |
| | | import torch |
| | | import torch.nn as nn |
| | | |
| | | from funasr.models.encoder.abs_encoder import AbsEncoder |
| | | from funasr.models.branchformer.cgmlp import ConvolutionalGatingMLP |
| | | from funasr.models.branchformer.fastformer import FastSelfAttention |
| | | from funasr.models.transformer.utils.nets_utils import make_pad_mask |
| | |
| | | ScaledPositionalEncoding, |
| | | ) |
| | | from funasr.models.transformer.layer_norm import LayerNorm |
| | | from funasr.models.transformer.repeat import repeat |
| | | from funasr.models.transformer.subsampling import ( |
| | | from funasr.models.transformer.utils.repeat import repeat |
| | | from funasr.models.transformer.utils.subsampling import ( |
| | | Conv2dSubsampling, |
| | | Conv2dSubsampling2, |
| | | Conv2dSubsampling6, |
| | |
| | | check_short_utt, |
| | | ) |
| | | |
| | | from funasr.utils.register import register_class |
| | | |
| | | class BranchformerEncoderLayer(torch.nn.Module): |
| | | """Branchformer encoder layer module. |
| | |
| | | |
| | | return x, mask |
| | | |
| | | |
| | | class BranchformerEncoder(AbsEncoder): |
| | | @register_class("encoder_classes", "BranchformerEncoder") |
| | | class BranchformerEncoder(nn.Module): |
| | | """Branchformer encoder module.""" |
| | | |
| | | def __init__( |