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
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/conv1d_nets.py
"""Convolution networks definition for custom archictecture.""" from typing import Optional, Tuple, Union import torch class Conv1d(torch.nn.Module): """1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving...
7,246
27.644269
88
py
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/transducer_tasks.py
"""Module implementing Transducer main and auxiliary tasks.""" from typing import Any, List, Optional, Tuple import torch from espnet.nets.pytorch_backend.nets_utils import pad_list from espnet.nets.pytorch_backend.transducer.joint_network import JointNetwork from espnet.nets.pytorch_backend.transformer.label_smooth...
15,051
31.231263
88
py
espnet
espnet-master/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,702
26.865979
82
py
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/error_calculator.py
"""CER/WER computation for Transducer model.""" from typing import List, Tuple, Union import torch from espnet.nets.beam_search_transducer import BeamSearchTransducer from espnet.nets.pytorch_backend.transducer.custom_decoder import CustomDecoder from espnet.nets.pytorch_backend.transducer.joint_network import Joint...
4,829
27.579882
79
py
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/initializer.py
"""Parameter initialization for Transducer model.""" import math from argparse import Namespace 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
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/custom_decoder.py
"""Custom decoder definition for Transducer model.""" from typing import Any, Dict, List, Optional, Tuple, Union import torch from espnet.nets.pytorch_backend.transducer.blocks import build_blocks from espnet.nets.pytorch_backend.transducer.utils import ( check_batch_states, check_state, pad_sequence, ) ...
9,049
29.782313
87
py
espnet
espnet-master/espnet/nets/pytorch_backend/transducer/blocks.py
"""Set of methods to create custom architecture.""" from typing import Any, Dict, List, Tuple, Union import torch from espnet.nets.pytorch_backend.conformer.convolution import ConvolutionModule from espnet.nets.pytorch_backend.conformer.encoder_layer import ( EncoderLayer as ConformerEncoderLayer, ) from espnet....
16,356
29.459963
88
py
espnet
espnet-master/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 torch from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence def encoder_init(m): """I...
6,261
35.196532
87
py
espnet
espnet-master/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 torch import torch.nn.functional as F from espnet.nets.pytorch_backend.rnn.attentions import AttForwardTA d...
24,375
35.059172
88
py
espnet
espnet-master/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, pad_packed_sequence from espnet...
9,068
31.978182
88
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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,171
30.941176
87
py
espnet
espnet-master/espnet/nets/pytorch_backend/rnn/decoders.py
"""RNN decoder module.""" import logging import math import random from argparse import Namespace import numpy as np import torch import torch.nn.functional as F from espnet.nets.ctc_prefix_score import CTCPrefixScore, CTCPrefixScoreTH from espnet.nets.e2e_asr_common import end_detect from espnet.nets.pytorch_backend...
48,709
39.356255
88
py
espnet
espnet-master/espnet/nets/pytorch_backend/rnn/attentions.py
"""Attention modules for RNN.""" import math import torch import torch.nn.functional as F from espnet.nets.pytorch_backend.nets_utils import make_pad_mask, to_device def _apply_attention_constraint( e, last_attended_idx, backward_window=1, forward_window=3 ): """Apply monotonic attention constraint. T...
73,205
36.217082
88
py
espnet
espnet-master/espnet/nets/pytorch_backend/rnn/encoders.py
import logging import numpy as np import torch import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from espnet.nets.e2e_asr_common import get_vgg2l_odim from espnet.nets.pytorch_backend.nets_utils import make_pad_mask, to_device class RNNP(torch.nn.Module): "...
14,152
37.045699
88
py
espnet
espnet-master/espnet/nets/pytorch_backend/lm/transformer.py
"""Transformer language model.""" import logging from typing import Any, List, Tuple 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 from espnet.nets.pytorch_backend.tr...
8,410
32.50996
86
py
espnet
espnet-master/espnet/nets/pytorch_backend/lm/default.py
"""Default Recurrent Neural Network Languge Model in `lm_train.py`.""" import logging from typing import Any, List, Tuple 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 import to_device from espnet.nets.scor...
14,561
32.865116
88
py
espnet
espnet-master/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
espnet
espnet-master/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 n...
6,761
36.566667
88
py
espnet
espnet-master/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 Convoluti...
12,154
39.516667
88
py
espnet
espnet-master/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
espnet
espnet-master/espnet/nets/pytorch_backend/conformer/contextual_block_encoder_layer.py
# -*- coding: utf-8 -*- """ Created on Sat Aug 21 16:57:31 2021. @author: Keqi Deng (UCAS) """ import torch from torch import nn from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class ContextualBlockEncoderLayer(nn.Module): """Contexutal Block Encoder layer module. Args: si...
11,220
35.080386
88
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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, ...
12,758
32.054404
88
py
espnet
espnet-master/espnet/nets/pytorch_backend/transformer/lightconv2d.py
"""Lightweight 2-Dimensional Convolution module.""" import numpy import torch import torch.nn.functional as F from torch import nn MIN_VALUE = float(numpy.finfo(numpy.float32).min) class LightweightConvolution2D(nn.Module): """Lightweight 2-Dimensional Convolution layer. This implementation is based on ...
4,229
33.112903
87
py
espnet
espnet-master/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(nn...
4,261
34.516667
87
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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,280
27.701087
83
py
espnet
espnet-master/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...
14,351
31.544218
87
py
espnet
espnet-master/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.trans...
15,107
38.757895
124
py
espnet
espnet-master/espnet/nets/pytorch_backend/transformer/longformer_attention.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2022 Roshan Sharma (Carnegie Mellon University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Longformer based Local Attention Definition.""" from longformer.longformer import LongformerConfig, LongformerSelfAttention from torch import nn ...
2,070
35.982143
81
py
espnet
espnet-master/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 ContextualBlockEn...
8,899
34.177866
87
py
espnet
espnet-master/espnet/nets/pytorch_backend/transformer/lightconv.py
"""Lightweight Convolution Module.""" import numpy import torch import torch.nn.functional as F from torch import nn MIN_VALUE = float(numpy.finfo(numpy.float32).min) class LightweightConvolution(nn.Module): """Lightweight Convolution layer. This implementation is based on https://github.com/pytorch/fa...
3,589
31.053571
87
py
espnet
espnet-master/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
espnet
espnet-master/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 di...
1,899
29.15873
70
py
espnet
espnet-master/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 __init__(self,...
1,299
26.659574
87
py
espnet
espnet-master/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, List, Tuple import torch from espnet.nets.pytorch_backend.nets_utils import rename_state_dict from espnet.nets....
13,734
39.756677
124
py
espnet
espnet-master/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 os import numpy from espnet.asr import asr_utils def _plot_and_save_attention(att_w, filename, xtokens=None, ytokens=None): import matplotlib matplotlib.use("Agg") import matplotlib.pyplot...
5,718
34.968553
88
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/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 torch from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args:...
11,646
37.062092
88
py
espnet
espnet-master/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
espnet
espnet-master/espnet/nets/pytorch_backend/transformer/dynamic_conv2d.py
"""Dynamic 2-Dimensional Convolution module.""" import numpy import torch import torch.nn.functional as F from torch import nn MIN_VALUE = float(numpy.finfo(numpy.float32).min) class DynamicConvolution2D(nn.Module): """Dynamic 2-Dimensional Convolution layer. This implementation is based on https://git...
4,862
34.23913
86
py
espnet
espnet-master/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
espnet
espnet-master/espnet/nets/pytorch_backend/transformer/dynamic_conv.py
"""Dynamic Convolution module.""" import numpy import torch import torch.nn.functional as F from torch import nn 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/m...
4,243
32.952
86
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/espnet/nets/pytorch_backend/frontends/dnn_wpe.py
from typing import Tuple import torch from pytorch_wpe import wpe_one_iteration 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,851
29.340426
78
py
espnet
espnet-master/espnet/nets/pytorch_backend/frontends/feature_transform.py
from typing import List, Tuple, 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, # Mel options, fs: int = 16000...
7,935
29.290076
88
py
espnet
espnet-master/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
espnet
espnet-master/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, RNNP class MaskEstimator(torch.nn.Module): def _...
2,637
33.25974
85
py
espnet
espnet-master/espnet/nets/pytorch_backend/frontends/frontend.py
from typing import List, Optional, Tuple, 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.frontends.dnn_wpe import DNN_WPE class Frontend(nn.Module): ...
4,557
29.590604
88
py
espnet
espnet-master/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 torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.frontends.beamformer import ( # noqa: H301 apply_beamforming_vector, get_mvdr_vector, get_power_spectral_density_matrix, ...
5,480
30.682081
85
py
espnet
espnet-master/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 import numpy as np import torch from chain...
19,744
32.240741
88
py
espnet
espnet-master/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 logging import os import random import sys import configargparse import numpy as np from...
13,800
32.497573
88
py
espnet
espnet-master/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...
22,288
31.163059
88
py
espnet
espnet-master/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
espnet
espnet-master/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
espnet
espnet-master/espnet/bin/asr_enhance.py
#!/usr/bin/env python3 import logging import os import random import sys from distutils.util import strtobool import configargparse 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
espnet
espnet-master/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
espnet
espnet-master/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 logging import os import subprocess import sys import configargparse from espnet.utils.cli_utils import strtobool # NOTE: you need this func to ...
5,267
29.807018
87
py
espnet
espnet-master/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 logging import os import random import sys import configargparse import numpy as np # NOTE: you n...
5,956
30.855615
88
py
espnet
espnet-master/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 logging import os import subprocess import sys import configargparse from espnet.utils.cli_utils import strtobool # NOTE: you need this func to g...
5,094
29.878788
87
py
espnet
espnet-master/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,207
35.893855
88
py
espnet
espnet-master/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,332
30.687386
88
py
espnet
espnet-master/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
espnet
espnet-master/espnet/bin/st_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) """End-to-end speech translation model decoding script.""" import logging import os import random import sys import configargparse import numpy as np # NOTE: yo...
5,855
30.826087
88
py
espnet
espnet-master/espnet/st/pytorch_backend/st.py
# Copyright 2019 Kyoto University (Hirofumi Inaguma) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Training/decoding definition for the speech translation task.""" import itertools import json import logging import os import numpy as np import torch from chainer import training from chainer.training...
22,845
32.795858
88
py
espnet
espnet-master/espnet/distributed/pytorch_backend/launch.py
# # SPDX-FileCopyrightText: # Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """This is a helper module for distributed training. The code uses an official implementation of distributed data parallel launcher as just a reference. https://github.com/p...
7,551
31.551724
129
py
espnet
espnet-master/espnet/asr/asr_utils.py
# Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import copy import json import logging import os import shutil import tempfile import numpy as np import torch # * -------------------- training iterator related --------------------...
34,453
32.646484
88
py
espnet
espnet-master/espnet/asr/asr_mix_utils.py
#!/usr/bin/env python3 """ This script is used to provide utility functions designed for multi-speaker ASR. Copyright 2017 Johns Hopkins University (Shinji Watanabe) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) Most functions can be directly used as in asr_utils.py: CompareValueTrigger, restore_snap...
6,407
33.451613
86
py
espnet
espnet-master/espnet/asr/pytorch_backend/asr_init.py
"""Finetuning methods.""" import logging import os import re from collections import OrderedDict import torch from espnet.asr.asr_utils import get_model_conf, torch_load from espnet.nets.asr_interface import ASRInterface from espnet.nets.mt_interface import MTInterface from espnet.nets.pytorch_backend.transducer.uti...
10,707
30.40176
87
py
espnet
espnet-master/espnet/asr/pytorch_backend/recog.py
"""V2 backend for `asr_recog.py` using py:class:`espnet.nets.beam_search.BeamSearch`.""" import json import logging import torch from packaging.version import parse as V from espnet.asr.asr_utils import add_results_to_json, get_model_conf, torch_load from espnet.asr.pytorch_backend.asr import load_trained_model from...
6,635
35.262295
88
py
espnet
espnet-master/espnet/asr/pytorch_backend/asr.py
# Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Training/decoding definition for the speech recognition task.""" import copy import itertools import json import logging import math import os import numpy as np import torch import torch.distri...
61,311
35.386944
103
py
espnet
espnet-master/espnet/asr/pytorch_backend/asr_mix.py
#!/usr/bin/env python3 """ This script is used for multi-speaker speech recognition. Copyright 2017 Johns Hopkins University (Shinji Watanabe) Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ import json import logging import os from itertools import zip_longest as zip_longest import numpy as np import ...
22,054
32.723242
88
py
espnet
espnet-master/espnet/lm/pytorch_backend/extlm.py
#!/usr/bin/env python3 # Copyright 2018 Mitsubishi Electric Research Laboratories (Takaaki Hori) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import math import torch import torch.nn as nn import torch.nn.functional as F from espnet.lm.lm_utils import make_lexical_tree from espnet.nets.pytorch_backe...
9,546
42.593607
87
py
espnet
espnet-master/espnet/lm/pytorch_backend/lm.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 """LM training ...
14,856
35.414216
88
py
espnet
espnet-master/espnet/tts/pytorch_backend/tts.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """E2E-TTS training / decoding functions.""" import copy import json import logging import math import os import time import chainer import kaldiio import nu...
26,532
34.614765
88
py
espnet
espnet-master/espnet/utils/spec_augment.py
# -*- coding: utf-8 -*- """ This implementation is modified from https://github.com/zcaceres/spec_augment MIT License Copyright (c) 2019 Zach Caceres Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Soft...
18,458
35.844311
88
py
espnet
espnet-master/espnet/utils/dataset.py
#!/usr/bin/env python # Copyright 2017 Johns Hopkins University (Shinji Watanabe) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """pytorch dataset and dataloader implementation for chainer training.""" import torch import torch.utils.data class Transform: """Transform function container. lamb...
3,703
27.9375
80
py
espnet
espnet-master/espnet/utils/fill_missing_args.py
# -*- coding: utf-8 -*- # Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import logging def fill_missing_args(args, add_arguments): """Fill missing arguments in args. Args: args (Namespace or None): Namesapce containing ...
1,426
29.361702
84
py
espnet
espnet-master/espnet/utils/deterministic_utils.py
import logging import os import chainer import torch def set_deterministic_pytorch(args): """Ensures pytorch produces deterministic results depending on the program arguments :param Namespace args: The program arguments """ # seed setting torch.manual_seed(args.seed) # debug mode setting ...
1,794
31.053571
88
py
espnet
espnet-master/espnet/utils/training/iterators.py
import chainer import numpy as np from chainer.iterators import MultiprocessIterator, SerialIterator, ShuffleOrderSampler from chainer.training.extension import Extension class ShufflingEnabler(Extension): """An extension enabling shuffling on an Iterator""" def __init__(self, iterators): """Inits th...
3,526
34.626263
88
py
espnet
espnet-master/espnet/optimizer/pytorch.py
"""PyTorch optimizer builders.""" import argparse import torch from espnet.optimizer.factory import OptimizerFactoryInterface from espnet.optimizer.parser import adadelta, adam, sgd class AdamFactory(OptimizerFactoryInterface): """Adam factory.""" @staticmethod def add_arguments(parser: argparse.Argume...
2,399
25.086957
82
py
espnet
espnet-master/espnet/optimizer/factory.py
"""Import optimizer class dynamically.""" import argparse from espnet.utils.dynamic_import import dynamic_import from espnet.utils.fill_missing_args import fill_missing_args class OptimizerFactoryInterface: """Optimizer adaptor.""" @staticmethod def from_args(target, args: argparse.Namespace): "...
2,013
27.771429
83
py
espnet
espnet-master/espnet/optimizer/chainer.py
"""Chainer optimizer builders.""" import argparse import chainer from chainer.optimizer_hooks import WeightDecay from espnet.optimizer.factory import OptimizerFactoryInterface from espnet.optimizer.parser import adadelta, adam, sgd class AdamFactory(OptimizerFactoryInterface): """Adam factory.""" @staticme...
2,588
25.690722
82
py
espnet
espnet-master/espnet/transform/spec_augment.py
"""Spec Augment module for preprocessing i.e., data augmentation""" import random import numpy from espnet.transform.functional import FuncTrans def time_warp(x, max_time_warp=80, inplace=False, mode="PIL"): """time warp for spec augment move random center frame by the random width ~ uniform(-window, wind...
5,933
28.088235
88
py
espnet
espnet-master/espnet2/svs/espnet_model.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Copyright 2021 Carnegie Mellon University (Jiatong Shi) # Copyright 2022 Renmin University of China (Yuning Wu) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Singing-voice-synthesis ESPnet model.""" from contextlib import contextmanager from distu...
28,411
42.443425
88
py
espnet
espnet-master/espnet2/svs/abs_svs.py
# Copyright 2021 Tomoki Hayashi # Copyright 2021 Carnegie Mellon University (Jiatong Shi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Singing-voice-synthesis abstrast class.""" from abc import ABC, abstractmethod from typing import Dict, Tuple import torch class AbsSVS(torch.nn.Module, ABC): ...
1,182
24.717391
68
py
espnet
espnet-master/espnet2/svs/singing_tacotron/singing_tacotron.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Copyright 2023 Renmin University of China (Yuning Wu) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Singing Tacotron related modules for ESPnet2.""" import logging from typing import Dict, Optional, Sequence, Tuple import six import torch import ...
28,517
39.915352
88
py
espnet
espnet-master/espnet2/svs/singing_tacotron/encoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Nagoya University (Tomoki Hayashi) # Copyright 2023 Renmin University of China (Yuning Wu) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Singing Tacotron encoder related modules.""" import torch from torch.nn.utils.rnn import pack_padde...
8,752
32.030189
87
py
espnet
espnet-master/espnet2/svs/singing_tacotron/decoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Nagoya University (Tomoki Hayashi) # Copyright 2023 Renmin University of China (Yuning Wu) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Singing Tacotron decoder related modules.""" import six import torch import torch.nn.functional as ...
17,363
37.932735
88
py
espnet
espnet-master/espnet2/svs/xiaoice/loss.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Copyright 2023 Renmin University of China (Yuning Wu) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """XiaoiceSing2 related loss module for ESPnet2.""" from typing import Tuple import torch from typeguard import check_argument_types from espnet.net...
5,424
40.730769
88
py
espnet
espnet-master/espnet2/svs/xiaoice/XiaoiceSing.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Copyright 2021 Renmin University of China (Shuai Guo) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """XiaoiceSing related modules.""" import logging from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from typeguar...
33,849
43.422572
88
py
espnet
espnet-master/espnet2/svs/feats_extract/score_feats_extract.py
from typing import Any, Dict, Optional, Tuple, Union import torch from typeguard import check_argument_types from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract from espnet.nets.pytorch_backend.nets_utils import make_pad_mask def ListsToTensor(xs): max_len = max(len(x) for x in xs) ys = ...
11,227
29.51087
86
py