repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_mt.py
# Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """RNN sequence-to-sequence text translation model (pytorch).""" import argparse import logging import math import os import chainer from chainer import reporter import nltk import numpy as np import torc...
13,758
35.78877
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_vc_transformer.py
# Copyright 2020 Nagoya University (Wen-Chin Huang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Voice Transformer Network (Transformer-VC) related modules.""" import logging import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.e2e_asr_transformer import subsequent_mask fr...
46,130
38.73385
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_vc_tacotron2.py
# Copyright 2020 Nagoya University (Wen-Chin Huang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Tacotron2-VC related modules.""" import logging from distutils.util import strtobool import numpy as np import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.rnn.attentions imp...
30,519
37.730964
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_conformer.py
# Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Northwestern Polytechnical University (Pengcheng Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Conformer speech recognition model (pytorch). It is a fusion of `e2e_asr_transformer.py` Refer to: https://arxiv.org/abs/20...
2,850
35.088608
82
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_tts_transformer.py
# Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """TTS-Transformer related modules.""" import logging import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.e2e_tts_tacotron2 import GuidedAttentionLoss from espnet.nets.pytorch_backend.e2e_tts_tacotr...
45,716
38.445211
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/gtn_ctc.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """GTN CTC implementation.""" import gtn import torch class GTNCTCLossFunction(torch.autograd.Function): """GTN CTC module.""" # Copied from FB's GTN example implementation: # https://github.com/facebookresearch/gtn_applications/blob/master/utils.py#L251 ...
3,974
32.403361
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_tts_tacotron2.py
# Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Tacotron 2 related modules.""" import logging import numpy as np import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask from espnet.nets.pytor...
34,205
37.048943
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/ctc.py
from distutils.version import LooseVersion import logging import numpy as np import six import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.nets_utils import to_device class CTC(torch.nn.Module): """CTC module :param int odim: dimension of outputs :param int eprojs: number of ...
10,704
36.299652
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_st.py
# Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """RNN sequence-to-sequence speech translation model (pytorch).""" import argparse import copy import logging import math import os import editdistance import nltk import chainer import numpy as np impor...
24,247
35.408408
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/wavenet.py
# -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """This code is based on https://github.com/kan-bayashi/PytorchWaveNetVocoder.""" import logging import sys import time import numpy as np import torch import torch.nn.functional a...
13,941
30.051225
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_mix_transformer.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2020 Johns Hopkins University (Xuankai Chang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Transformer speech recognition model for single-channel multi-speaker mixture speech. It is a fusion of `e2e_asr_mix.py` and `e2e_asr_transformer.py`. Ref...
18,291
38.507559
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_st_conformer.py
# Copyright 2020 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Conformer speech translation model (pytorch). It is a fusion of `e2e_st_transformer.py` Refer to: https://arxiv.org/abs/2005.08100 """ from espnet.nets.pytorch_backend.conformer.encoder import Encode...
2,608
33.786667
82
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/initialization.py
#!/usr/bin/env python # Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Initialization functions for RNN sequence-to-sequence models.""" import math def lecun_normal_init_parameters(module): """Initialize parameters in the LeCun's manner.""" ...
1,561
26.892857
67
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_mt_transformer.py
# Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Transformer text translation model (pytorch).""" from argparse import Namespace import logging import math import numpy as np import torch from espnet.nets.e2e_asr_common import end_detect from espnet...
16,196
38.408759
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/nets_utils.py
# -*- coding: utf-8 -*- """Network related utility tools.""" import logging from typing import Dict import numpy as np import torch def to_device(m, x): """Send tensor into the device of the module. Args: m (torch.nn.Module): Torch module. x (Tensor): Torch tensor. Returns: Te...
17,262
31.63327
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_maskctc.py
# Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Waseda University (Yosuke Higuchi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Mask CTC based non-autoregressive speech recognition model (pytorch). See https://arxiv.org/abs/2005.08700 for the detail. """ from itertool...
10,568
37.714286
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_transducer.py
"""Transducer speech recognition model (pytorch).""" from argparse import ArgumentParser from argparse import Namespace from dataclasses import asdict import logging import math import numpy from typing import List import chainer import torch from espnet.nets.asr_interface import ASRInterface from espnet.nets.beam_s...
17,897
32.833648
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_mulenc.py
# Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Copyright 2017 Johns Hopkins University (Ruizhi Li) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Define e2e module for multi-encoder network. https://arxiv.org/pdf/1811.04903.pdf.""" import argparse from itertools import groupby import lo...
31,659
34.653153
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_transformer.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Transformer speech recognition model (pytorch).""" from argparse import Namespace from distutils.util import strtobool import logging import math import numpy import torch import torch.nn as nn import random from IPython ...
51,287
44.548845
151
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_asr_mix.py
#!/usr/bin/env python3 """ This script is used to construct End-to-End models of multi-speaker ASR. Copyright 2017 Johns Hopkins University (Shinji Watanabe) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ import argparse from itertools import groupby import logging import math import os import sys im...
31,145
36.615942
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/e2e_st_transformer.py
# Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Transformer speech recognition model (pytorch).""" from argparse import Namespace import logging import math import numpy import torch from espnet.nets.e2e_asr_common import end_detect from espnet.net...
22,844
37.918228
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/streaming/window.py
import torch # TODO(pzelasko): Currently allows half-streaming only; # needs streaming attention decoder implementation class WindowStreamingE2E(object): """WindowStreamingE2E constructor. :param E2E e2e: E2E ASR object :param recog_args: arguments for "recognize" method of E2E """ def __init__...
2,768
32.768293
84
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/streaming/segment.py
import numpy as np import torch class SegmentStreamingE2E(object): """SegmentStreamingE2E constructor. :param E2E e2e: E2E ASR object :param recog_args: arguments for "recognize" method of E2E """ def __init__(self, e2e, recog_args, rnnlm=None): self._e2e = e2e self._recog_args =...
4,774
35.730769
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/joint_network.py
"""Transducer joint network implementation.""" import torch from espnet.nets.pytorch_backend.nets_utils import get_activation class JointNetwork(torch.nn.Module): """Transducer joint network module. Args: joint_output_size: Joint network output dimension encoder_output_size: Encoder output ...
1,905
29.741935
80
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/rnn_encoder.py
"""RNN encoder implementation for transducer model. These classes are based on the ones in espnet.nets.pytorch_backend.rnn.encoders, and modified to output intermediate representation based given list of layers as input. To do so, RNN class rely on a stack of 1-layer LSTM instead of a multi-layer LSTM. The additional ...
18,462
31.165505
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/causal_conv1d.py
"""CausalConv1d module definition for custom decoder.""" from typing import Optional from typing import Tuple import torch class CausalConv1d(torch.nn.Module): """CausalConv1d module for custom decoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the co...
1,995
25.613333
85
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/rnn_decoder.py
"""RNN decoder definition for transducer model.""" from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import torch from espnet.nets.transducer_decoder_interface import ExtendedHypothesis from espnet.nets.transducer_deco...
9,130
29.847973
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/vgg2l.py
"""VGG2L module definition for custom encoder.""" from typing import Tuple from typing import Union import torch class VGG2L(torch.nn.Module): """VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class. """ d...
2,800
28.797872
81
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/tdnn.py
"""TDNN modules definition for custom encoder.""" from typing import Tuple from typing import Union import torch class TDNN(torch.nn.Module): """TDNN module with symmetric context. Args: idim: Input dimension. odim: Output dimension. ctx_size: Size of the context window. str...
5,399
31.53012
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/utils.py
"""Utility functions for transducer models.""" import os from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Union import numpy as np import torch from espnet.nets.pytorch_backend.nets_utils import pad_list from espnet.nets.transducer_decoder_interfac...
10,615
24.892683
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/custom_encoder.py
"""Cutom encoder definition for transducer models.""" from typing import List from typing import Tuple from typing import Union import torch from espnet.nets.pytorch_backend.transducer.blocks import build_blocks from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L from espnet.nets.pytorch_backend.transfor...
4,309
32.937008
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/transducer_tasks.py
"""Module implementing transducer main and auxiliary tasks.""" from typing import Any from typing import List from typing import Optional from typing import Tuple import torch from espnet.nets.pytorch_backend.nets_utils import pad_list from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import ( La...
15,065
31.055319
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/transformer_decoder_layer.py
"""Transformer decoder layer definition for custom transducer model.""" from typing import Optional import torch from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm from espnet.nets.pytorch_backend.transformer.pos...
2,716
27.010309
82
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/error_calculator.py
"""CER/WER computation for transducer model.""" from typing import List from typing import Tuple from typing import Union import editdistance import torch from espnet.nets.beam_search_transducer import BeamSearchTransducer from espnet.nets.pytorch_backend.transducer.custom_decoder import CustomDecoder from espnet.ne...
4,827
27.738095
79
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/initializer.py
"""Parameter initialization for transducer model.""" from argparse import Namespace import math import torch from espnet.nets.pytorch_backend.initialization import set_forget_bias_to_one def initializer(model: torch.nn.Module, args: Namespace): """Initialize transducer model. Args: model: Transduc...
1,304
29.348837
79
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/custom_decoder.py
"""Custom decoder definition for transducer model.""" from typing import Any from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import torch from espnet.nets.pytorch_backend.transducer.blocks import build_blocks from espnet.nets.pytorch_backe...
9,230
30.397959
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transducer/blocks.py
"""Set of methods to create custom architecture.""" from collections import Counter from typing import Dict from typing import List from typing import Tuple from typing import Union import torch from espnet.nets.pytorch_backend.conformer.convolution import ConvolutionModule from espnet.nets.pytorch_backend.conformer...
18,963
32.153846
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/tacotron2/encoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Tacotron2 encoder related modules.""" import six import torch from torch.nn.utils.rnn import pack_padded_sequence from torch.nn.utils.rnn import pad_pack...
6,320
34.711864
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/tacotron2/decoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Tacotron2 decoder related modules.""" import six import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.rnn.attentions import AttF...
24,426
35.081241
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/tacotron2/cbhg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """CBHG related modules.""" import torch import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence from torch.nn.utils.rnn import p...
9,099
31.851986
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/fastspeech/duration_calculator.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Duration calculator related modules.""" import torch from espnet.nets.pytorch_backend.e2e_tts_tacotron2 import Tacotron2 from espnet.nets.pytorch_backend.e2e_tts_transformer ...
3,600
35.744898
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/fastspeech/duration_predictor.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Duration predictor related modules.""" import torch from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class DurationPredictor(torch.nn.Module): "...
4,992
31.422078
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/fastspeech/length_regulator.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Length regulator related modules.""" import logging import torch from espnet.nets.pytorch_backend.nets_utils import pad_list class LengthRegulator(torch.nn.Module): ""...
2,173
30.970588
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/rnn/decoders.py
"""RNN decoder module.""" import logging import math import random import six import numpy as np import torch import torch.nn.functional as F from argparse import Namespace from espnet.nets.ctc_prefix_score import CTCPrefixScore from espnet.nets.ctc_prefix_score import CTCPrefixScoreTH from espnet.nets.e2e_asr_commo...
49,193
39.488889
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/rnn/attentions.py
"""Attention modules for RNN.""" import math import six import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_backend.nets_utils import to_device def _apply_attention_constraint( e, last_attended_idx, backward_window=1, forward_wi...
67,013
36.044776
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/rnn/encoders.py
import logging import six import numpy as np import torch import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence from torch.nn.utils.rnn import pad_packed_sequence from espnet.nets.e2e_asr_common import get_vgg2l_odim from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from e...
14,199
37.069705
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/lm/transformer.py
"""Transformer language model.""" from typing import Any from typing import List from typing import Tuple import logging import torch import torch.nn as nn import torch.nn.functional as F from espnet.nets.lm_interface import LMInterface from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding...
8,446
32.387352
86
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/lm/default.py
"""Default Recurrent Neural Network Languge Model in `lm_train.py`.""" from typing import Any from typing import List from typing import Tuple import logging import torch import torch.nn as nn import torch.nn.functional as F from espnet.nets.lm_interface import LMInterface from espnet.nets.pytorch_backend.e2e_asr im...
14,597
32.791667
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/lm/seq_rnn.py
"""Sequential implementation of Recurrent Neural Network Language Model.""" import torch import torch.nn as nn import torch.nn.functional as F from espnet.nets.lm_interface import LMInterface class SequentialRNNLM(LMInterface, torch.nn.Module): """Sequential RNNLM. See also: https://github.com/pyto...
5,940
32.189944
118
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/conformer/encoder_layer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Northwestern Polytechnical University (Pengcheng Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder self-attention layer definition.""" import torch from torch import ...
6,756
36.331492
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/conformer/encoder.py
# Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Northwestern Polytechnical University (Pengcheng Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" import logging import torch from espnet.nets.pytorch_backend.conformer.convolution import Convolutio...
25,965
41.221138
142
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/conformer/convolution.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Northwestern Polytechnical University (Pengcheng Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ConvolutionModule definition.""" from torch import nn class ConvolutionMod...
2,193
26.425
79
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/conformer/swish.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Northwestern Polytechnical University (Pengcheng Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Swish() activation function for Conformer.""" import torch class Swish(tor...
483
24.473684
70
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/maskctc/add_mask_token.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Waseda University (Yosuke Higuchi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Token masking module for Masked LM.""" import numpy def mask_uniform(ys_pad, mask_token, eos,...
1,352
32.825
74
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/maskctc/mask.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Johns Hopkins University (Shinji Watanabe) # Waseda University (Yosuke Higuchi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Attention masking module for Masked LM.""" def square_mask(ys_in_pad, ignore_id): """Creat...
803
31.16
74
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/embedding.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Positional Encoding Module.""" import math import torch def _pre_hook( state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, ...
7,989
31.612245
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/lightconv2d.py
"""Lightweight 2-Dimensional Convolution module.""" import numpy import torch from torch import nn import torch.nn.functional as F MIN_VALUE = float(numpy.finfo(numpy.float32).min) class LightweightConvolution2D(nn.Module): """Lightweight 2-Dimensional Convolution layer. This implementation is based on ...
4,230
32.848
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/encoder_layer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder self-attention layer definition.""" import torch from torch import nn from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class EncoderLayer(n...
4,256
34.181818
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Label smoothing module.""" import torch from torch import nn class LabelSmoothingLoss(nn.Module): """Label-smoothing loss. :param int size: the number of class ...
2,164
32.828125
75
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/positionwise_feed_forward.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Positionwise feed forward layer definition.""" import torch class PositionwiseFeedForward(torch.nn.Module): """Positionwise feed forward layer. Args: idim (...
983
28.818182
85
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/encoder_mix.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder Mix definition.""" import torch from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L from espnet.nets.pytorch_backend.transformer.attention import MultiHead...
6,407
38.801242
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/argument.py
# Copyright 2020 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Transformer common arguments.""" from distutils.util import strtobool def add_arguments_transformer_common(group): """Add Transformer common arguments.""" group.add_argument( "--transformer-init", ...
5,107
27.696629
83
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/subsampling.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Subsampling layer definition.""" import torch from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding class TooShortUttError(Exception): """Rai...
9,087
32.784387
154
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/encoder.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" import logging import torch from espnet.nets.pytorch_backend.nets_utils import rename_state_dict from espnet.nets.pytorch_backend.transducer.vgg2l import VGG2L from espnet.nets.pytorch_backend.transf...
31,994
40.124679
142
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/contextual_block_encoder_layer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Emiru Tsunoo # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder self-attention layer definition.""" import torch from torch import nn from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class ContextualBlockE...
5,036
35.23741
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/lightconv.py
"""Lightweight Convolution Module.""" import numpy import torch from torch import nn import torch.nn.functional as F MIN_VALUE = float(numpy.finfo(numpy.float32).min) class LightweightConvolution(nn.Module): """Lightweight Convolution layer. This implementation is based on https://github.com/pytorch/f...
3,590
30.778761
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/multi_layer_conv.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Layer modules for FFT block in FastSpeech (Feed-forward Transformer).""" import torch class MultiLayeredConv1d(torch.nn.Module): """Multi-layered conv1d for Transformer ...
3,164
28.858491
80
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/subsampling_without_posenc.py
# Copyright 2020 Emiru Tsunoo # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Subsampling layer definition.""" import math import torch class Conv2dSubsamplingWOPosEnc(torch.nn.Module): """Convolutional 2D subsampling. Args: idim (int): Input dimension. odim (int): Output dim...
1,898
29.629032
70
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/repeat.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Repeat the same layer definition.""" import torch class MultiSequential(torch.nn.Sequential): """Multi-input multi-output torch.nn.Sequential.""" def forward(self, ...
703
19.705882
59
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/decoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Decoder definition.""" import logging from typing import Any from typing import List from typing import Tuple import torch from espnet.nets.pytorch_backend.nets_utils impor...
16,725
39.400966
124
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/plot.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import logging import matplotlib.pyplot as plt import numpy import os from espnet.asr import asr_utils def _plot_and_save_attention(att_w, filename, xtokens=None, ytokens=None): # dynamically import matplotlib due to no...
5,536
36.666667
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/layer_norm.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Layer normalization module.""" import torch class LayerNorm(torch.nn.LayerNorm): """Layer normalization module. Args: nout (int): Output dim size. d...
958
21.302326
59
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/add_sos_eos.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Unility functions for Transformer.""" import torch def add_sos_eos(ys_pad, sos, eos, ignore_id): """Add <sos> and <eos> labels. :param torch.Tensor ys_pad: batch of...
957
28.9375
74
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/attention.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Multi-Head Attention layer definition.""" import math import numpy import torch from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention laye...
51,687
46.074681
187
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/decoder_layer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Decoder self-attention layer definition.""" import torch from torch import nn from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class DecoderLayer(nn...
4,877
35.133333
87
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/dynamic_conv2d.py
"""Dynamic 2-Dimensional Convolution module.""" import numpy import torch from torch import nn import torch.nn.functional as F MIN_VALUE = float(numpy.finfo(numpy.float32).min) class DynamicConvolution2D(nn.Module): """Dynamic 2-Dimensional Convolution layer. This implementation is based on https://gi...
4,863
33.992806
86
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/mask.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Mask module.""" import torch def subsequent_mask(size, device="cpu", dtype=torch.bool): """Create mask for subsequent steps (size, size). :param int size: size of mask :param str device: "cpu" or "cuda" or to...
1,037
27.833333
77
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/dynamic_conv.py
"""Dynamic Convolution module.""" import numpy import torch from torch import nn import torch.nn.functional as F MIN_VALUE = float(numpy.finfo(numpy.float32).min) class DynamicConvolution(nn.Module): """Dynamic Convolution layer. This implementation is based on https://github.com/pytorch/fairseq/tree/...
4,244
32.690476
86
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/initializer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Parameter initialization.""" import torch from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm def initialize(model, init_type="pytorch"): """Initia...
1,383
29.755556
75
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/optimizer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Optimizer module.""" import torch class NoamOpt(object): """Optim wrapper that implements rate.""" def __init__(self, model_size, factor, warmup, optimizer): ...
2,094
26.565789
76
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/transformer/diagonaled_mm_tvm.py
from typing import Union from functools import lru_cache import torch import os.path class DiagonaledMM(torch.autograd.Function): '''Class to encapsulate tvm code for compiling a diagonal_mm function, in addition to calling this function from PyTorch ''' function_dict = {} # save a list of function...
17,439
51.848485
189
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/dnn_wpe.py
from typing import Tuple from pytorch_wpe import wpe_one_iteration import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.frontends.mask_estimator import MaskEstimator from espnet.nets.pytorch_backend.nets_utils import make_pad_mask class DNN_WPE(torch.nn.Module): def __ini...
2,855
29.382979
78
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/feature_transform.py
from typing import List from typing import Tuple from typing import Union import librosa import numpy as np import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.nets_utils import make_pad_mask class FeatureTransform(torch.nn.Module): def __init__( self, # ...
7,975
29.212121
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/beamformer.py
import torch from torch_complex import functional as FC from torch_complex.tensor import ComplexTensor def get_power_spectral_density_matrix( xs: ComplexTensor, mask: torch.Tensor, normalization=True, eps: float = 1e-15 ) -> ComplexTensor: """Return cross-channel power spectral density (PSD) matrix Args:...
2,731
31.141176
81
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/mask_estimator.py
from typing import Tuple import numpy as np import torch from torch.nn import functional as F from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_backend.rnn.encoders import RNN from espnet.nets.pytorch_backend.rnn.encoders import RN...
2,691
33.512821
85
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/frontend.py
from typing import List from typing import Optional from typing import Tuple from typing import Union import numpy import torch import torch.nn as nn from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.frontends.dnn_beamformer import DNN_Beamformer from espnet.nets.pytorch_backend.frontend...
4,611
29.342105
88
py
a3t-dev_richard
a3t-dev_richard/espnet/nets/pytorch_backend/frontends/dnn_beamformer.py
"""DNN beamformer module.""" from typing import Tuple import torch from torch.nn import functional as F from espnet.nets.pytorch_backend.frontends.beamformer import apply_beamforming_vector from espnet.nets.pytorch_backend.frontends.beamformer import get_mvdr_vector from espnet.nets.pytorch_backend.frontends.beamform...
5,596
31.352601
85
py
a3t-dev_richard
a3t-dev_richard/espnet/mt/pytorch_backend/mt.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Training/decoding definition for the text translation task.""" import itertools import json import logging import os from chainer import training from chainer....
20,126
32.770134
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/asr_recog.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """End-to-end speech recognition model decoding script.""" import configargparse import logging import os import random import sys import numpy as np from...
13,482
32.291358
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/asr_train.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2017 Tomoki Hayashi (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Automatic speech recognition model training script.""" import logging import os import random import subprocess import sys import configargparse import numpy as...
20,130
30.454688
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/lm_train.py
#!/usr/bin/env python3 # Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) # This code is ported from the following implementation written in Torch. # https://github.com/chainer/chainer/blob/master/examples/ptb/train_ptb_custom_loop.py """Language m...
8,939
29.934256
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/tts_train.py
#!/usr/bin/env python3 # Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Text-to-speech model training script.""" import logging import os import random import subprocess import sys import configargparse import numpy as np from espnet import __versio...
10,680
28.669444
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/asr_enhance.py
#!/usr/bin/env python3 import configargparse from distutils.util import strtobool import logging import os import random import sys import numpy as np from espnet.asr.pytorch_backend.asr import enhance # NOTE: you need this func to generate our sphinx doc def get_parser(): parser = configargparse.ArgumentParser...
5,778
29.098958
87
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/vc_train.py
#!/usr/bin/env python3 # Copyright 2020 Nagoya University (Wen-Chin Huang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Voice conversion model training script.""" import logging import os import random import subprocess import sys import configargparse import numpy as np from espnet import __vers...
10,830
28.352304
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/tts_decode.py
#!/usr/bin/env python3 # Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """TTS decoding script.""" import configargparse import logging import os import subprocess import sys from espnet.utils.cli_utils import strtobool # NOTE: you need this func to g...
5,266
29.982353
87
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/mt_trans.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Neural machine translation model decoding script.""" import configargparse import logging import os import random import sys import numpy as np # NOTE: you n...
5,956
30.855615
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/vc_decode.py
#!/usr/bin/env python3 # Copyright 2020 Nagoya University (Wen-Chin Huang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """VC decoding script.""" import configargparse import logging import os import subprocess import sys from espnet.utils.cli_utils import strtobool # NOTE: you need this func to ge...
5,093
30.060976
87
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/asr_align.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2020 Johns Hopkins University (Xuankai Chang) # 2020, Technische Universität München; Dominik Winkelbauer, Ludwig Kürzinger # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ This program performs CTC segmentation to align utterances within ...
13,269
36.380282
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/st_train.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """End-to-end speech translation model training script.""" import logging import os import random import subprocess import sys import configargparse import numpy ...
17,343
30.707495
88
py
a3t-dev_richard
a3t-dev_richard/espnet/bin/mt_train.py
#!/usr/bin/env python3 # encoding: utf-8 # Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Neural machine translation model training script.""" import logging import os import random import subprocess import sys import configargparse import numpy as ...
14,923
30.352941
88
py