From 8a0ce9d1282ba88365900b7d86f28d0abb5862ec Mon Sep 17 00:00:00 2001 From: glynpu <839019390@qq.com> Date: Wed, 9 Dec 2020 14:49:14 +0800 Subject: [PATCH] fix typos --- wenet/transformer/convolution.py | 3 +-- wenet/transformer/encoder.py | 2 +- wenet/transformer/positionwise_feed_forward.py | 4 ++-- wenet/transformer/swish.py | 2 +- wenet/utils/common.py | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/wenet/transformer/convolution.py b/wenet/transformer/convolution.py index 1b873db01..dfc8d4dcd 100644 --- a/wenet/transformer/convolution.py +++ b/wenet/transformer/convolution.py @@ -12,7 +12,6 @@ class ConvolutionModule(nn.Module): """ConvolutionModule in Conformer model.""" - def __init__(self, channels: int, kernel_size: int = 15, @@ -44,7 +43,7 @@ def __init__(self, padding = 0 self.lorder = kernel_size - 1 else: - # kernerl_size should be an odd number for none causal convolution + # kernel_size should be an odd number for none causal convolution assert (kernel_size - 1) % 2 == 0 padding = (kernel_size - 1) // 2 self.lorder = 0 diff --git a/wenet/transformer/encoder.py b/wenet/transformer/encoder.py index 64309fad1..7d2572659 100644 --- a/wenet/transformer/encoder.py +++ b/wenet/transformer/encoder.py @@ -224,7 +224,7 @@ def __init__( compatibility. activation_type (str): Encoder activation function type. use_cnn_module (bool): Whether to use convolution module. - cnn_module_kernel (int): Kernerl size of convolution module. + cnn_module_kernel (int): Kernel size of convolution module. causal (bool): whether to use causal convolution or not. """ assert check_argument_types() diff --git a/wenet/transformer/positionwise_feed_forward.py b/wenet/transformer/positionwise_feed_forward.py index 7d5878b7d..3e3634a0b 100644 --- a/wenet/transformer/positionwise_feed_forward.py +++ b/wenet/transformer/positionwise_feed_forward.py @@ -22,7 +22,7 @@ def __init__(self, hidden_units: int, dropout_rate: float, activation: torch.nn.Module = torch.nn.ReLU()): - """Construct an PositionwiseFeedForward object.""" + """Construct a PositionwiseFeedForward object.""" super(PositionwiseFeedForward, self).__init__() self.w_1 = torch.nn.Linear(idim, hidden_units) self.w_2 = torch.nn.Linear(hidden_units, idim) @@ -30,5 +30,5 @@ def __init__(self, self.activation = activation def forward(self, x: torch.Tensor) -> torch.Tensor: - """Forward funciton.""" + """Forward function.""" return self.w_2(self.dropout(self.activation(self.w_1(x)))) diff --git a/wenet/transformer/swish.py b/wenet/transformer/swish.py index 12c9f1858..2571ad452 100644 --- a/wenet/transformer/swish.py +++ b/wenet/transformer/swish.py @@ -12,5 +12,5 @@ class Swish(torch.nn.Module): """Construct an Swish object.""" def forward(self, x: torch.Tensor) -> torch.Tensor: - """Return Swich activation function.""" + """Return Swish activation function.""" return x * torch.sigmoid(x) diff --git a/wenet/utils/common.py b/wenet/utils/common.py index 38154eb0b..e5a634cf0 100644 --- a/wenet/utils/common.py +++ b/wenet/utils/common.py @@ -1,4 +1,4 @@ -"""Unility funcitons for Transformer.""" +"""Unility functions for Transformer.""" import math from typing import Tuple, List