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/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
a3t-dev_richard
a3t-dev_richard/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 from chainer import training from chainer.training import extensions import numpy ...
23,250
33.04246
87
py
a3t-dev_richard
a3t-dev_richard/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,457
32.617561
88
py
a3t-dev_richard
a3t-dev_richard/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,393
33.010638
86
py
a3t-dev_richard
a3t-dev_richard/espnet/asr/pytorch_backend/asr_init.py
"""Finetuning methods.""" from collections import OrderedDict import logging import os import re import torch from espnet.asr.asr_utils import get_model_conf from espnet.asr.asr_utils import torch_load from espnet.nets.asr_interface import ASRInterface from espnet.nets.mt_interface import MTInterface from espnet.nets...
10,738
30.492669
87
py
a3t-dev_richard
a3t-dev_richard/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 espnet.asr.asr_utils import add_results_to_json from espnet.asr.asr_utils import get_model_conf from espnet.asr.asr_utils import torch_load from espnet.asr.pytorch_backend.asr import ...
6,059
35.727273
88
py
a3t-dev_richard
a3t-dev_richard/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 from chainer import reporter as reporter_module fro...
52,218
34.815501
88
py
a3t-dev_richard
a3t-dev_richard/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 # chainer related from chainer import training from chainer.training import...
22,407
33.210687
88
py
a3t-dev_richard
a3t-dev_richard/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
a3t-dev_richard
a3t-dev_richard/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 ...
15,129
35.812652
88
py
a3t-dev_richard
a3t-dev_richard/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,681
34.623498
88
py
a3t-dev_richard
a3t-dev_richard/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
a3t-dev_richard
a3t-dev_richard/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 TransformDataset(torch.utils.data.Dataset): """Transf...
2,561
26.548387
80
py
a3t-dev_richard
a3t-dev_richard/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
a3t-dev_richard
a3t-dev_richard/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
a3t-dev_richard
a3t-dev_richard/espnet/utils/training/iterators.py
import chainer from chainer.iterators import MultiprocessIterator from chainer.iterators import SerialIterator from chainer.iterators import ShuffleOrderSampler from chainer.training.extension import Extension import numpy as np class ShufflingEnabler(Extension): """An extension enabling shuffling on an Iterator...
3,585
34.156863
88
py
a3t-dev_richard
a3t-dev_richard/espnet/optimizer/pytorch.py
"""PyTorch optimizer builders.""" import argparse import torch from espnet.optimizer.factory import OptimizerFactoryInterface from espnet.optimizer.parser import adadelta from espnet.optimizer.parser import adam from espnet.optimizer.parser import sgd class AdamFactory(OptimizerFactoryInterface): """Adam factor...
2,469
25.276596
82
py
a3t-dev_richard
a3t-dev_richard/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
a3t-dev_richard
a3t-dev_richard/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 from espnet.optimizer.parser import adam from espnet.optimizer.parser import sgd class AdamFact...
2,658
25.858586
82
py
a3t-dev_richard
a3t-dev_richard/espnet/transform/spec_augment.py
"""Spec Augment module for preprocessing i.e., data augmentation""" import random import numpy from PIL import Image from PIL.Image import BICUBIC 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 cent...
5,924
28.187192
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/espnet_model.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based text-to-speech ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Any from typing import Dict from typing import Optional import torch from typeg...
9,340
38.918803
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/abs_gan_tts.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based TTS abstrast class.""" from abc import ABC from abc import abstractmethod from typing import Dict from typing import Union import torch from espnet2.tts.abs_tts import AbsTTS class AbsGANTTS(AbsTTS, ABC): ...
634
20.896552
70
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/melgan/residual_stack.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Residual stack module in MelGAN. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ from typing import Any from typing import Dict import torch class ResidualStack(torch.nn.Module): """R...
2,482
33.486111
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/melgan/pqmf.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Pseudo QMF modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import numpy as np import torch import torch.nn.functional as F from scipy.signal import kaiser def design_prototype_fi...
5,142
30.944099
84
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/melgan/melgan.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """MelGAN Modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import logging from typing import Any from typing import Dict from typing import List import numpy as np import torch from ...
16,735
34.914163
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/wavenet/wavenet.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """WaveNet modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import logging import math from typing import Optional import torch from espnet2.gan_tts.wavenet.residual_block import Con...
6,952
34.294416
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/wavenet/residual_block.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Residual block modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import math from typing import Optional from typing import Tuple import torch import torch.nn.functional as F clas...
5,371
30.6
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/joint/joint_text2wav.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Joint text-to-wav module for end-to-end training.""" from typing import Any from typing import Dict import torch from typeguard import check_argument_types from espnet2.gan_tts.abs_gan_tts import AbsGANTTS from espnet2.g...
24,411
37.565561
104
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/style_melgan/tade_res_block.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """StyleMelGAN's TADEResBlock Modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ from functools import partial import torch class TADELayer(torch.nn.Module): """TADE Layer module."...
5,864
30.532258
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/style_melgan/style_melgan.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """StyleMelGAN Modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import copy import logging import math from typing import Any from typing import Dict from typing import List from typin...
12,131
33.078652
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/hifigan/loss.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """HiFiGAN-related loss modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ from typing import List from typing import Optional from typing import Tuple from typing import Union import to...
10,236
33.468013
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/hifigan/residual_block.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """HiFiGAN Residual block modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ from typing import Any from typing import Dict from typing import List import torch class ResidualBlock(tor...
3,349
32.5
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/hifigan/hifigan.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """HiFi-GAN Modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import copy import logging from typing import Any from typing import Dict from typing import List from typing import Option...
27,078
35.105333
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/utils/get_random_segments.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Function to get random segments.""" from typing import Tuple import torch def get_random_segments( x: torch.Tensor, x_lengths: torch.Tensor, segment_size: int, ) -> Tuple[torch.Tensor, torch.Tensor]: """G...
1,429
23.655172
67
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/residual_coupling.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Residual affine coupling modules in VITS. This code is based on https://github.com/jaywalnut310/vits. """ from typing import Optional from typing import Tuple from typing import Union import torch from espnet2.gan_tts.v...
7,632
32.186957
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/flow.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Basic Flow modules used in VITS. This code is based on https://github.com/jaywalnut310/vits. """ import math from typing import Optional from typing import Tuple from typing import Union import torch from espnet2.gan_t...
9,419
29
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/transform.py
"""Flow-related transformation. This code is derived from https://github.com/bayesiains/nflows. """ import torch from torch.nn import functional as F import numpy as np DEFAULT_MIN_BIN_WIDTH = 1e-3 DEFAULT_MIN_BIN_HEIGHT = 1e-3 DEFAULT_MIN_DERIVATIVE = 1e-3 # TODO(kan-bayashi): Documentation and type hint def p...
7,506
33.278539
83
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/loss.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """VITS-related loss modules. This code is based on https://github.com/jaywalnut310/vits. """ import torch class KLDivergenceLoss(torch.nn.Module): """KL divergence loss.""" def forward( self, z_p:...
1,318
26.479167
83
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/duration_predictor.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Stochastic duration predictor modules in VITS. This code is based on https://github.com/jaywalnut310/vits. """ import math from typing import Optional import torch import torch.nn.functional as F from espnet2.gan_tts.v...
6,313
31.885417
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/vits.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """VITS module for GAN-TTS task.""" from typing import Any from typing import Dict from typing import Optional import torch from typeguard import check_argument_types from espnet2.gan_tts.abs_gan_tts import AbsGANTTS from e...
23,567
37.509804
104
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/generator.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Generator module in VITS. This code is based on https://github.com/jaywalnut310/vits. """ import math from typing import List from typing import Optional from typing import Tuple import numpy as np import torch import t...
25,501
43.121107
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/text_encoder.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Text encoder module in VITS. This code is based on https://github.com/jaywalnut310/vits. """ import math from typing import Tuple import torch from espnet.nets.pytorch_backend.conformer.encoder import Encoder from espn...
5,388
36.950704
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/posterior_encoder.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Posterior encoder module in VITS. This code is based on https://github.com/jaywalnut310/vits. """ from typing import Optional from typing import Tuple import torch from espnet.nets.pytorch_backend.nets_utils import make...
4,055
33.372881
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/vits/monotonic_align/__init__.py
"""Maximum path calculation module. This code is based on https://github.com/jaywalnut310/vits. """ import warnings import numpy as np import torch from numba import njit from numba import prange try: from .core import maximum_path_c is_cython_avalable = True except ImportError: is_cython_avalable = ...
2,511
29.634146
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/parallel_wavegan/parallel_wavegan.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Parallel WaveGAN Modules. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ import logging import math from typing import Any from typing import Dict from typing import Optional import numpy...
12,564
34.097765
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/gan_tts/parallel_wavegan/upsample.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Upsampling module. This code is modified from https://github.com/kan-bayashi/ParallelWaveGAN. """ from typing import Any from typing import Dict from typing import List from typing import Optional import numpy as np impo...
6,215
31.715789
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/espnet_model.py
"""Enhancement model module.""" from distutils.version import LooseVersion from functools import reduce from itertools import permutations from typing import Dict from typing import Optional from typing import Tuple import ci_sdr import torch from typeguard import check_argument_types from espnet2.enh.decoder.abs_dec...
27,236
37.416079
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/abs_enh.py
from abc import ABC from abc import abstractmethod from collections import OrderedDict from typing import Tuple import torch class AbsEnhancement(torch.nn.Module, ABC): # @abstractmethod # def output_size(self) -> int: # raise NotImplementedError @abstractmethod def forward( self, ...
658
23.407407
56
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/conformer_separator.py
from collections import OrderedDict from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.conformer.encoder import ( Encoder as ConformerEncoder, # noqa: H30...
6,643
38.547619
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/dprnn_separator.py
from collections import OrderedDict from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet2.enh.layers.complex_utils import is_complex from espnet2.enh.layers.dprnn import DPRNN from e...
3,956
30.91129
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/tcn_separator.py
from collections import OrderedDict from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet2.enh.layers.complex_utils import is_complex from espnet2.enh.layers.tcn import TemporalConvNe...
3,393
29.854545
84
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/transformer_separator.py
from collections import OrderedDict from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.nets_utils import make_non_pad_mask from espnet.nets.pytorch_backend.tr...
5,626
35.303226
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/neural_beamformer.py
from collections import OrderedDict from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet2.enh.layers.dnn_beamformer import DNN_Beamformer from espnet2.enh.layers.dnn_wpe import DNN_WPE from espnet2.enh.separator.abs_separator...
10,189
38.042146
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/abs_separator.py
from abc import ABC from abc import abstractmethod from collections import OrderedDict from typing import Tuple import torch class AbsSeparator(torch.nn.Module, ABC): @abstractmethod def forward( self, input: torch.Tensor, ilens: torch.Tensor, ) -> Tuple[Tuple[torch.Tensor], torch...
470
19.478261
63
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/rnn_separator.py
from collections import OrderedDict from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.rnn.encoders import RNN from espnet2.enh.layers.complex_utils import is_...
3,403
28.859649
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/separator/asteroid_models.py
from collections import OrderedDict from typing import Tuple import warnings import torch from espnet2.enh.separator.abs_separator import AbsSeparator class AsteroidModel_Converter(AbsSeparator): def __init__( self, encoder_output_dim: int, model_name: str, num_spk: int, ...
5,206
32.165605
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/wpe.py
from distutils.version import LooseVersion from typing import Tuple from typing import Union import torch import torch.nn.functional as F import torch_complex.functional as FC from torch_complex.tensor import ComplexTensor from espnet2.enh.layers.complex_utils import einsum from espnet2.enh.layers.complex_utils impor...
7,993
30.34902
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/dnn_wpe.py
from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.enh.layers.complex_utils import to_double from espnet2.enh.layers.complex_utils import to_float from espnet2.enh.layers.mask_estim...
5,578
32.407186
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/beamformer.py
"""Beamformer module.""" from distutils.version import LooseVersion from typing import List from typing import Optional from typing import Union import numpy as np import torch from torch_complex import functional as FC from torch_complex.tensor import ComplexTensor from espnet2.enh.layers.complex_utils import einsum...
26,737
34.986541
109
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/dprnn.py
# The implementation of DPRNN in # Luo. et al. "Dual-path rnn: efficient long sequence modeling # for time-domain single-channel speech separation." # # The code is based on: # https://github.com/yluo42/TAC/blob/master/utility/models.py # import torch from torch.autograd import Variable import torch.nn as nn EPS = ...
7,628
30.524793
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/mask_estimator.py
from distutils.version import LooseVersion from typing import Tuple from typing import Union 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.encoder...
3,487
34.232323
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/complex_utils.py
"""Beamformer module.""" from distutils.version import LooseVersion from typing import Tuple from typing import Union import torch from torch_complex import functional as FC from torch_complex.tensor import ComplexTensor EPS = torch.finfo(torch.double).eps is_torch_1_8_plus = LooseVersion(torch.__version__) >= Loose...
5,182
34.5
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/tcn.py
# Implementation of the TCN proposed in # Luo. et al. "Conv-tasnet: Surpassing ideal time–frequency # magnitude masking for speech separation." # # The code is based on: # https://github.com/kaituoxu/Conv-TasNet/blob/master/src/conv_tasnet.py # import torch import torch.nn as nn import torch.nn.functional as F EPS ...
8,610
28.693103
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/layers/dnn_beamformer.py
"""DNN beamformer module.""" from distutils.version import LooseVersion from typing import List from typing import Tuple from typing import Union import logging import torch from torch.nn import functional as F from torch_complex import functional as FC from torch_complex.tensor import ComplexTensor from espnet2.enh....
21,909
40.029963
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/encoder/abs_encoder.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsEncoder(torch.nn.Module, ABC): @abstractmethod def forward( self, input: torch.Tensor, ilens: torch.Tensor, ) -> Tuple[torch.Tensor, torch.Tensor]: raise NotImplementedError ...
421
19.095238
43
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/encoder/null_encoder.py
import torch from espnet2.enh.encoder.abs_encoder import AbsEncoder class NullEncoder(AbsEncoder): """Null encoder.""" def __init__(self): super().__init__() @property def output_dim(self) -> int: return 1 def forward(self, input: torch.Tensor, ilens: torch.Tensor): """...
503
20
64
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/encoder/stft_encoder.py
from distutils.version import LooseVersion import torch from torch_complex.tensor import ComplexTensor from espnet2.enh.encoder.abs_encoder import AbsEncoder from espnet2.layers.stft import Stft is_torch_1_9_plus = LooseVersion(torch.__version__) >= LooseVersion("1.9.0") class STFTEncoder(AbsEncoder): """STFT e...
1,668
28.280702
76
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/encoder/conv_encoder.py
import torch from espnet2.enh.encoder.abs_encoder import AbsEncoder class ConvEncoder(AbsEncoder): """Convolutional encoder for speech enhancement and separation""" def __init__( self, channel: int, kernel_size: int, stride: int, ): super().__init__() self...
1,301
26.125
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/decoder/conv_decoder.py
import torch from espnet2.enh.decoder.abs_decoder import AbsDecoder class ConvDecoder(AbsDecoder): """Transposed Convolutional decoder for speech enhancement and separation""" def __init__( self, channel: int, kernel_size: int, stride: int, ): super().__init__() ...
873
25.484848
80
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/decoder/null_decoder.py
import torch from espnet2.enh.decoder.abs_decoder import AbsDecoder class NullDecoder(AbsDecoder): """Null decoder, return the same args.""" def __init__(self): super().__init__() def forward(self, input: torch.Tensor, ilens: torch.Tensor): """Forward. The input should be the waveform a...
493
23.7
64
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/decoder/abs_decoder.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsDecoder(torch.nn.Module, ABC): @abstractmethod def forward( self, input: torch.Tensor, ilens: torch.Tensor, ) -> Tuple[torch.Tensor, torch.Tensor]: raise NotImplementedError
319
19
43
py
a3t-dev_richard
a3t-dev_richard/espnet2/enh/decoder/stft_decoder.py
from distutils.version import LooseVersion import torch from torch_complex.tensor import ComplexTensor from espnet2.enh.decoder.abs_decoder import AbsDecoder from espnet2.layers.stft import Stft is_torch_1_9_plus = LooseVersion(torch.__version__) >= LooseVersion("1.9.0") class STFTDecoder(AbsDecoder): """STFT d...
1,411
27.24
76
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/forward_adaptor.py
import torch from typeguard import check_argument_types class ForwardAdaptor(torch.nn.Module): """Wrapped module to parallelize specified method torch.nn.DataParallel parallelizes only "forward()" and, maybe, the method having the other name can't be applied except for wrapping the module just like t...
1,052
29.970588
67
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/initialize.py
#!/usr/bin/env python3 """Initialize modules for espnet2 neural networks.""" import math import torch from typeguard import check_argument_types def initialize(model: torch.nn.Module, init: str): """Initialize weights of a neural network module. Parameters are initialized using the given method or distribu...
3,788
35.786408
79
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/model_summary.py
import humanfriendly import numpy as np import torch def get_human_readable_count(number: int) -> str: """Return human_readable_count Originated from: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/core/memory.py Abbreviates an integer number with K, M, B, T for ...
2,500
34.225352
102
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/load_pretrained_model.py
from typing import Any from typing import Dict from typing import Union import logging import torch import torch.nn import torch.optim def filter_state_dict( dst_state: Dict[str, Union[float, torch.Tensor]], src_state: Dict[str, Union[float, torch.Tensor]], ): """Filter name, size mismatch instances betw...
4,894
35.804511
450
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/add_gradient_noise.py
import torch def add_gradient_noise( model: torch.nn.Module, iteration: int, duration: float = 100, eta: float = 1.0, scale_factor: float = 0.55, ): """Adds noise from a standard normal distribution to the gradients. The standard deviation (`sigma`) is controlled by the three hyper-pa...
989
29.9375
71
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/device_funcs.py
import dataclasses import warnings import numpy as np import torch def to_device(data, device=None, dtype=None, non_blocking=False, copy=False): """Change the device of object recursively""" if isinstance(data, dict): return { k: to_device(v, device, dtype, non_blocking, copy) for k, v in...
2,681
36.25
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/pytorch_version.py
import torch def pytorch_cudnn_version() -> str: message = ( f"pytorch.version={torch.__version__}, " f"cuda.available={torch.cuda.is_available()}, " ) if torch.backends.cudnn.enabled: message += ( f"cudnn.version={torch.backends.cudnn.version()}, " f"cudnn...
468
26.588235
71
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/recursive_op.py
"""Torch utility module.""" import torch if torch.distributed.is_available(): from torch.distributed import ReduceOp def recursive_sum(obj, weight: torch.Tensor, distributed: bool = False): assert weight.dim() == 1, weight.size() if isinstance(obj, (tuple, list)): return type(obj)(recursive_sum(v...
1,615
32.666667
81
py
a3t-dev_richard
a3t-dev_richard/espnet2/torch_utils/set_all_random_seed.py
import random import numpy as np import torch def set_all_random_seed(seed: int): random.seed(seed) np.random.seed(seed) torch.random.manual_seed(seed)
167
14.272727
35
py
a3t-dev_richard
a3t-dev_richard/espnet2/main_funcs/collect_stats.py
from collections import defaultdict import logging from pathlib import Path from typing import Dict from typing import Iterable from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from torch.nn.parallel import data_parallel from torch.utils.data import DataLoade...
5,036
38.661417
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/main_funcs/calculate_all_attentions.py
from collections import defaultdict from typing import Dict from typing import List import torch from espnet.nets.pytorch_backend.rnn.attentions import AttAdd from espnet.nets.pytorch_backend.rnn.attentions import AttCov from espnet.nets.pytorch_backend.rnn.attentions import AttCovLoc from espnet.nets.pytorch_backend...
5,882
35.540373
103
py
a3t-dev_richard
a3t-dev_richard/espnet2/main_funcs/average_nbest_models.py
import logging from pathlib import Path from typing import Sequence from typing import Union import warnings import torch from typeguard import check_argument_types from typing import Collection from espnet2.train.reporter import Reporter @torch.no_grad() def average_nbest_models( output_dir: Path, reporter...
3,653
34.134615
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/main_funcs/pack_funcs.py
from datetime import datetime from io import BytesIO from io import TextIOWrapper import os from pathlib import Path import sys import tarfile from typing import Dict from typing import Iterable from typing import Optional from typing import Union import zipfile import yaml class Archiver: def __init__(self, fil...
9,903
31.686469
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/enh_inference.py
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import Any from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import humanfriendly import numpy as np import torch from tqdm import trange...
17,784
32.94084
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/lm_calc_perplexity.py
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import numpy as np import torch from torch.nn.parallel import data_parallel from typeguard import check_argument_types fro...
6,742
30.957346
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/diar_inference.py
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import Any from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import numpy as np import torch from tqdm import trange from typeguard impo...
11,979
30.036269
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/tts_inference.py
#!/usr/bin/env python3 """Script to run the inference of text-to-speeech model.""" import argparse import logging import shutil import sys import time from distutils.version import LooseVersion from pathlib import Path from typing import Any from typing import Dict from typing import Optional from typing import Sequ...
25,842
33.274536
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/sedit_inference.py
#!/usr/bin/env python3 """Script to run the inference of text-to-speeech model.""" from espnet2.torch_utils.set_all_random_seed import set_all_random_seed from espnet2.tasks.mlm import MLMTask from espnet2.tasks.tts import TTSTask import matplotlib.pylab as plt from parallel_wavegan.utils import download_pretrained_mo...
44,710
48.678889
263
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/asr_inference.py
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import Any from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import numpy as np import torch from typeguard import check_argument_types from typeguard import che...
18,241
31.575
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/launch.py
#!/usr/bin/env python3 import argparse import logging import os from pathlib import Path import shlex import shutil import subprocess import sys import uuid from espnet.utils.cli_utils import get_commandline_args from espnet2.utils.types import str2bool from espnet2.utils.types import str_or_none def get_parser(): ...
13,188
32.992268
173
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/enh_scoring.py
#!/usr/bin/env python3 import argparse import logging import sys from typing import List from typing import Union from mir_eval.separation import bss_eval_sources import numpy as np from pystoi import stoi import torch from typeguard import check_argument_types from espnet.utils.cli_utils import get_commandline_args ...
4,752
30.686667
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/k2_asr_inference.py
#!/usr/bin/env python3 import argparse import logging from pathlib import Path import sys from typing import Any from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple from typing import Union import k2 import k2.ragged as k2r import numpy as np import torch from typeg...
17,298
31.214153
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/bin/asr_align.py
#!/usr/bin/env python3 # Copyright 2021, Ludwig Kürzinger; Kamo Naoyuki # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Perform CTC segmentation to align utterances within audio files.""" import argparse import logging from pathlib import Path import sys from typing import Optional from typing import Te...
32,475
38.222222
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/hubert/espnet_model.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Thanks to Abdelrahman Mohamed and Wei-Ning Hsu's help in this implementation, # Their origial Hubert work is in: # Paper: https://arxiv.org/pdf/2106.07447.pdf # Code in Fairseq: https://github.com/pytorch/fairseq/tree/master/examples/hubert from contextlib impo...
8,675
32.890625
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/hubert/hubert_loss.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # The HubertPretrainLoss Module uses code from Fairseq: # https://github.com/pytorch/fairseq/blob/master/fairseq/criterions/hubert_criterion.py # # Thanks to Abdelrahman Mohamed and Wei-Ning Hsu's help in this implementation, # Their origial Hubert work is in: # P...
2,827
36.706667
91
py
a3t-dev_richard
a3t-dev_richard/espnet2/diar/abs_diar.py
from abc import ABC from abc import abstractmethod from collections import OrderedDict from typing import Tuple import torch class AbsDiarization(torch.nn.Module, ABC): # @abstractmethod # def output_size(self) -> int: # raise NotImplementedError @abstractmethod def forward( self, ...
658
23.407407
56
py
a3t-dev_richard
a3t-dev_richard/espnet2/diar/espnet_model.py
# Copyright 2021 Jiatong Shi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from contextlib import contextmanager from distutils.version import LooseVersion from itertools import permutations from typing import Dict from typing import Optional from typing import Tuple import numpy as np import torch from...
10,315
35.58156
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/diar/label_processor.py
import torch from espnet2.layers.label_aggregation import LabelAggregate class LabelProcessor(torch.nn.Module): """Label aggregator for speaker diarization""" def __init__( self, win_length: int = 512, hop_length: int = 128, center: bool = True ): super().__init__() self.label_ag...
749
24
79
py