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/espnet2/diar/decoder/linear_decoder.py
import torch from espnet2.diar.decoder.abs_decoder import AbsDecoder class LinearDecoder(AbsDecoder): """Linear decoder for speaker diarization""" def __init__( self, encoder_output_size: int, num_spk: int = 2, ): super().__init__() self._num_spk = num_spk ...
754
21.878788
75
py
a3t-dev_richard
a3t-dev_richard/espnet2/diar/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 ...
411
18.619048
43
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/inversible_interface.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class InversibleInterface(ABC): @abstractmethod def inverse( self, input: torch.Tensor, input_lengths: torch.Tensor = None ) -> Tuple[torch.Tensor, torch.Tensor]: # return output, output_lengths ...
349
22.333333
69
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/stft.py
from distutils.version import LooseVersion from typing import Optional from typing import Tuple from typing import Union import torch from torch_complex.tensor import ComplexTensor from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.enh.layers.compl...
6,159
32.661202
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/global_mvn.py
from pathlib import Path from typing import Tuple from typing import Union import numpy as np import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.layers.abs_normalize import AbsNormalize from espnet2.layers.inversible_interface import I...
3,518
27.844262
71
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/utterance_mvn.py
from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.layers.abs_normalize import AbsNormalize class UtteranceMVN(AbsNormalize): def __init__( self, norm_means: bool = True, norm_vars...
2,323
25.11236
83
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/mask_along_axis.py
import torch from typeguard import check_argument_types from typing import Sequence from typing import Union def mask_along_axis( spec: torch.Tensor, spec_lengths: torch.Tensor, mask_width_range: Sequence[int] = (0, 30), dim: int = 1, num_mask: int = 2, replace_with_zero: bool = True, ): "...
3,725
27.883721
81
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/label_aggregation.py
import torch from typeguard import check_argument_types from typing import Optional from typing import Tuple from espnet.nets.pytorch_backend.nets_utils import make_pad_mask class LabelAggregate(torch.nn.Module): def __init__( self, win_length: int = 512, hop_length: int = 128, ce...
2,536
29.566265
83
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/log_mel.py
import librosa import torch from typing import Tuple from espnet.nets.pytorch_backend.nets_utils import make_pad_mask class LogMel(torch.nn.Module): """Convert STFT to fbank feats The arguments is same as librosa.filters.mel Args: fs: number > 0 [scalar] sampling rate of the incoming signal ...
2,577
29.690476
74
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/abs_normalize.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsNormalize(torch.nn.Module, ABC): @abstractmethod def forward( self, input: torch.Tensor, input_lengths: torch.Tensor = None ) -> Tuple[torch.Tensor, torch.Tensor]: # return output, output_len...
359
23
69
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/sinc_conv.py
#!/usr/bin/env python3 # 2020, Technische Universität München; Ludwig Kürzinger # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Sinc convolutions.""" import math import torch from typeguard import check_argument_types from typing import Union class LogCompression(torch.nn.Module): """Log Compres...
9,027
31.948905
84
py
a3t-dev_richard
a3t-dev_richard/espnet2/layers/time_warp.py
"""Time warp module.""" import torch from espnet.nets.pytorch_backend.nets_utils import pad_list DEFAULT_TIME_WARP_MODE = "bicubic" def time_warp(x: torch.Tensor, window: int = 80, mode: str = DEFAULT_TIME_WARP_MODE): """Time warping using torch.interpolate. Args: x: (Batch, Time, Freq) win...
2,526
27.393258
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/abs_gan_espnet_model.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ESPnetModel abstract class for GAN-based training.""" from abc import ABC from abc import abstractmethod from typing import Dict from typing import Union import torch from espnet2.train.abs_espnet_model import AbsESPnetMo...
2,946
39.369863
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/reporter.py
"""Reporter module.""" from collections import defaultdict from contextlib import contextmanager import dataclasses import datetime from distutils.version import LooseVersion import logging from pathlib import Path import time from typing import ContextManager from typing import Dict from typing import List from typing...
19,600
32.736661
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/dataset.py
from abc import ABC from abc import abstractmethod import collections import copy import functools import logging import numbers import re from typing import Any from typing import Callable from typing import Collection from typing import Dict from typing import Mapping from typing import Tuple from typing import Union...
15,178
32.433921
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/gan_trainer.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Trainer module for GAN-based training.""" import argparse import dataclasses import logging import time from contextlib import contextmanager from distutils.version import LooseVersion from typing import Dict from typing i...
15,357
39.954667
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/distributed_utils.py
import dataclasses import os import socket from typing import Optional import torch import torch.distributed @dataclasses.dataclass class DistributedOption: # Enable distributed Training distributed: bool = False # torch.distributed.Backend: "nccl", "mpi", "gloo", or "tcp" dist_backend: str = "nccl" ...
13,914
36.506739
99
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/iterable_dataset.py
"""Iterable dataset module.""" import copy from io import StringIO from pathlib import Path from typing import Callable from typing import Collection from typing import Dict from typing import Iterator from typing import Tuple from typing import Union import kaldiio import numpy as np import soundfile import torch fro...
8,341
34.05042
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/collate_fn.py
from typing import Collection from typing import Dict from typing import List from typing import Tuple from typing import Union import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type import math from espnet.nets.pytorch_backend.nets_utils import pad_list, mak...
18,595
39.514161
227
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/trainer.py
"""Trainer module.""" import argparse from contextlib import contextmanager import dataclasses from dataclasses import is_dataclass from distutils.version import LooseVersion import logging from pathlib import Path import time from typing import Dict from typing import Iterable from typing import List from typing impor...
34,379
40.026253
115
py
a3t-dev_richard
a3t-dev_richard/espnet2/train/abs_espnet_model.py
from abc import ABC from abc import abstractmethod from typing import Dict from typing import Tuple import torch class AbsESPnetModel(torch.nn.Module, ABC): """The common abstract class among each tasks "ESPnetModel" is referred to a class which inherits torch.nn.Module, and makes the dnn-models forward...
1,399
31.55814
82
py
a3t-dev_richard
a3t-dev_richard/espnet2/samplers/abs_sampler.py
from abc import ABC from abc import abstractmethod from typing import Iterator from typing import Tuple from torch.utils.data import Sampler class AbsSampler(Sampler, ABC): @abstractmethod def __len__(self) -> int: raise NotImplementedError @abstractmethod def __iter__(self) -> Iterator[Tupl...
425
20.3
52
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/espnet_model.py
from contextlib import contextmanager from distutils.version import LooseVersion import logging from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import torch import math import numpy as np from typeguard import check_argument_types from espn...
35,903
40.316456
243
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/ctc.py
import logging import torch import torch.nn.functional as F from typeguard import check_argument_types class CTC(torch.nn.Module): """CTC module. Args: odim: dimension of outputs encoder_output_sizse: number of encoder projection units dropout_rate: dropout rate (0.0 ~ 1.0) c...
5,708
33.810976
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/postencoder/abs_postencoder.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsPostEncoder(torch.nn.Module, ABC): @abstractmethod def output_size(self) -> int: raise NotImplementedError @abstractmethod def forward( self, input: torch.Tensor, input_lengths: torch.Te...
403
21.444444
62
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/postencoder/hugging_face_transformers_postencoder.py
#!/usr/bin/env python3 # 2021, University of Stuttgart; Pavel Denisov # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Hugging Face Transformers PostEncoder.""" from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.asr.postencoder.abs_postencoder import AbsPostEncoder from tran...
3,208
30.15534
77
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/specaug/specaug.py
"""SpecAugment module.""" from typing import Sequence from typing import Union from espnet2.asr.specaug.abs_specaug import AbsSpecAug from espnet2.layers.mask_along_axis import MaskAlongAxis from espnet2.layers.time_warp import TimeWarp class SpecAug(AbsSpecAug): """Implementation of SpecAug. Reference: ...
2,436
31.065789
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/specaug/abs_specaug.py
from typing import Optional from typing import Tuple import torch class AbsSpecAug(torch.nn.Module): """Abstract class for the augmentation of spectrogram The process-flow: Frontend -> SpecAug -> Normalization -> Encoder -> Decoder """ def forward( self, x: torch.Tensor, x_lengths: to...
426
21.473684
63
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/frontend/s3prl.py
from argparse import Namespace import copy import logging import os from typing import Optional from typing import Tuple from typing import Union import humanfriendly import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.frontends.frontend import Frontend from espnet.nets.pytorch_ba...
4,012
32.165289
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/frontend/windowing.py
#!/usr/bin/env python3 # 2020, Technische Universität München; Ludwig Kürzinger # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Sliding Window for raw audio input data.""" from espnet2.asr.frontend.abs_frontend import AbsFrontend import torch from typeguard import check_argument_types from typing imp...
2,812
33.304878
82
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/frontend/default.py
import copy from typing import Optional from typing import Tuple from typing import Union import humanfriendly import numpy as np import torch from torch_complex.tensor import ComplexTensor from typeguard import check_argument_types from espnet.nets.pytorch_backend.frontends.frontend import Frontend from espnet2.asr....
4,381
32.19697
77
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/frontend/abs_frontend.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsFrontend(torch.nn.Module, ABC): @abstractmethod def output_size(self) -> int: raise NotImplementedError @abstractmethod def forward( self, input: torch.Tensor, input_lengths: torch.Tenso...
400
21.277778
62
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/preencoder/linear.py
#!/usr/bin/env python3 # 2021, Carnegie Mellon University; Xuankai Chang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Linear Projection.""" from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder from typeguard import check_argument_types from typing import Tuple import torch class Line...
1,040
25.692308
66
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/preencoder/abs_preencoder.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch class AbsPreEncoder(torch.nn.Module, ABC): @abstractmethod def output_size(self) -> int: raise NotImplementedError @abstractmethod def forward( self, input: torch.Tensor, input_lengths: torch.Ten...
402
21.388889
62
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/preencoder/sinc.py
#!/usr/bin/env python3 # 2020, Technische Universität München; Ludwig Kürzinger # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Sinc convolutions for raw audio input.""" from collections import OrderedDict from espnet2.asr.preencoder.abs_preencoder import AbsPreEncoder from espnet2.layers.sinc_conv i...
10,292
35.371025
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/hubert_encoder.py
# Copyright 2021 Tianzi Wang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0 # 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/mast...
13,543
33.55102
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/rnn_encoder.py
from typing import Optional from typing import Sequence from typing import Tuple import numpy as np import torch from typeguard import check_argument_types 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.enc...
3,671
30.655172
80
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/contextual_block_transformer_encoder.py
# Copyright 2020 Emiru Tsunoo # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_ba...
12,541
37.237805
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/conformer_encoder.py
# Copyright 2020 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Conformer encoder definition.""" from typing import Optional from typing import Tuple import logging import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.conformer.convolution import C...
13,189
41.006369
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/transformer_encoder.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_...
7,808
40.1
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/vgg_rnn_encoder.py
from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from espnet.nets.e2e_asr_common import get_vgg2l_odim 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.encod...
3,517
31.878505
80
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/mlm_encoder.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_...
13,502
41.731013
156
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/abs_encoder.py
from abc import ABC from abc import abstractmethod from typing import Optional from typing import Tuple import torch class AbsEncoder(torch.nn.Module, ABC): @abstractmethod def output_size(self) -> int: raise NotImplementedError @abstractmethod def forward( self, xs_pad: torc...
503
21.909091
67
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/encoder/wav2vec2_encoder.py
# Copyright 2021 Xuankai Chang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Encoder definition.""" import contextlib import copy from filelock import FileLock import logging import os from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from e...
5,610
32.201183
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/decoder/rnn_decoder.py
import random import numpy as np import torch import torch.nn.functional as F from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet.nets.pytorch_backend.nets_utils import to_device from espnet.nets.pytorch_backend.rnn.attentions import initial_att from...
12,171
35.334328
81
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/decoder/transformer_decoder.py
# Copyright 2019 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Decoder definition.""" from typing import Any from typing import List from typing import Sequence from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils...
19,423
36.210728
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/asr/decoder/abs_decoder.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch from espnet.nets.scorer_interface import ScorerInterface class AbsDecoder(torch.nn.Module, ScorerInterface, ABC): @abstractmethod def forward( self, hs_pad: torch.Tensor, hlens: torch.Tensor, ...
462
22.15
56
py
a3t-dev_richard
a3t-dev_richard/espnet2/lm/espnet_model.py
from typing import Dict from typing import Tuple import torch import torch.nn.functional as F from typeguard import check_argument_types from espnet.nets.pytorch_backend.nets_utils import make_pad_mask from espnet2.lm.abs_model import AbsLM from espnet2.torch_utils.device_funcs import force_gatherable from espnet2.tr...
2,482
34.985507
84
py
a3t-dev_richard
a3t-dev_richard/espnet2/lm/seq_rnn_lm.py
"""Sequential implementation of Recurrent Neural Network Language Model.""" from typing import Tuple from typing import Union import torch import torch.nn as nn from typeguard import check_argument_types from espnet2.lm.abs_model import AbsLM class SequentialRNNLM(AbsLM): """Sequential RNNLM. See also: ...
5,484
32.445122
118
py
a3t-dev_richard
a3t-dev_richard/espnet2/lm/transformer_lm.py
from typing import Any from typing import List from typing import Tuple import torch import torch.nn as nn from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding from espnet.nets.pytorch_backend.transformer.encoder import Encoder from espnet.nets.pytorch_backend.transformer.mask import subse...
4,275
31.393939
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/lm/abs_model.py
from abc import ABC from abc import abstractmethod from typing import Tuple import torch from espnet.nets.scorer_interface import BatchScorerInterface class AbsLM(torch.nn.Module, BatchScorerInterface, ABC): """The abstract LM class To share the loss calculation way among different models, We uses dele...
762
24.433333
66
py
a3t-dev_richard
a3t-dev_richard/espnet2/iterators/sequence_iter_factory.py
from typing import Any from typing import Sequence from typing import Union import numpy as np from torch.utils.data import DataLoader from typeguard import check_argument_types from espnet2.iterators.abs_iter_factory import AbsIterFactory from espnet2.samplers.abs_sampler import AbsSampler class RawSampler(AbsSamp...
5,364
35.746575
90
py
a3t-dev_richard
a3t-dev_richard/espnet2/iterators/chunk_iter_factory.py
import logging from typing import Any from typing import Dict from typing import Iterator from typing import List 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 espnet2.iterators.abs_iter_factory import AbsI...
7,811
35.166667
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/espnet_model.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Text-to-speech ESPnet model.""" from contextlib import contextmanager from distutils.version import LooseVersion from typing import Dict from typing import Optional from typing import Tuple import torch...
12,383
39.07767
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/abs_tts.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Text-to-speech abstrast class.""" from abc import ABC from abc import abstractmethod from typing import Dict from typing import Tuple import torch class AbsTTS(torch.nn.Module, ABC): """TTS abstract class.""" @a...
1,146
23.404255
68
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/tacotron2/tacotron2.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Tacotron 2 related modules for ESPnet2.""" import logging from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple import torch import torch.nn.functiona...
21,228
38.829268
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/fastspeech/fastspeech.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Fastspeech related modules for ESPnet2.""" import logging from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple import torch import torch.nn.functiona...
29,911
41.129577
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/fastspeech2/loss.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Fastspeech2 related loss module for ESPnet2.""" from typing import Tuple import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.fastspeech.duration_predictor import (...
5,332
40.664063
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/fastspeech2/variance_predictor.py
#!/usr/bin/env python3 # Copyright 2020 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Variance predictor related modules.""" import torch from typeguard import check_argument_types from espnet.nets.pytorch_backend.transformer.layer_norm import LayerNorm class VariancePredictor(tor...
2,625
28.840909
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/fastspeech2/fastspeech2.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Fastspeech2 related modules for ESPnet2.""" import logging from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple import torch import torch.nn.function...
36,189
41.930012
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/energy.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Energy extractor.""" from typing import Any from typing import Dict from typing import Tuple from typing import Union import humanfriendly import torch import torch.nn.functional as F from typeguard im...
4,788
32.256944
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/abs_feats_extract.py
from abc import ABC from abc import abstractmethod from typing import Any from typing import Dict import torch from typing import Tuple class AbsFeatsExtract(torch.nn.Module, ABC): @abstractmethod def output_size(self) -> int: raise NotImplementedError @abstractmethod def get_parameters(self...
554
22.125
62
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/log_spectrogram.py
from typing import Any from typing import Dict from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from espnet2.layers.stft import Stft from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract class LogSpectrogram(AbsFeatsExtract): """Conve...
2,298
28.857143
82
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/linear_spectrogram.py
from typing import Any from typing import Dict from typing import Optional from typing import Tuple import torch from typeguard import check_argument_types from espnet2.layers.stft import Stft from espnet2.tts.feats_extract.abs_feats_extract import AbsFeatsExtract class LinearSpectrogram(AbsFeatsExtract): """Li...
2,146
28.410959
71
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/log_mel_fbank.py
from typing import Any from typing import Dict from typing import Optional from typing import Tuple from typing import Union import humanfriendly import torch from typeguard import check_argument_types from espnet2.layers.log_mel import LogMel from espnet2.layers.stft import Stft from espnet2.tts.feats_extract.abs_fe...
3,116
28.130841
82
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/feats_extract/dio.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """F0 extractor using DIO + Stonemask algorithm.""" import logging from typing import Any from typing import Dict from typing import Tuple from typing import Union import humanfriendly import numpy as np ...
6,280
32.409574
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/utils/duration_calculator.py
# -*- coding: utf-8 -*- # Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Duration calculator for ESPnet2.""" from typing import Tuple import torch class DurationCalculator(torch.nn.Module): """Duration calculator module.""" @torch.no_grad(...
2,291
33.727273
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/utils/parallel_wavegan_pretrained_vocoder.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Wrapper class for the vocoder model trained with parallel_wavegan repo.""" import logging import os from pathlib import Path from typing import Optional from typing import Union import yaml import torch class ParallelW...
1,941
29.34375
79
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/gst/style_encoder.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Style encoder of GST-Tacotron.""" from typeguard import check_argument_types from typing import Sequence import torch from espnet.nets.pytorch_backend.transformer.attention import ( MultiHeadedAtte...
10,109
36.032967
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/transformer/transformer.py
# Copyright 2020 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Transformer-TTS related modules.""" from typing import Dict from typing import Optional from typing import Sequence from typing import Tuple import torch import torch.nn.functional as F from typeguard ...
35,126
40.472255
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tts/sedit/sedit_model.py
from contextlib import contextmanager from distutils.version import LooseVersion import logging from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import torch import math import numpy as np from typeguard import check_argument_types from espn...
24,888
43.52415
284
py
a3t-dev_richard
a3t-dev_richard/espnet2/optimizers/sgd.py
import torch from typeguard import check_argument_types class SGD(torch.optim.SGD): """Thin inheritance of torch.optim.SGD to bind the required arguments, 'lr' Note that the arguments of the optimizer invoked by AbsTask.main() must have default value except for 'param'. I can't understand why on...
828
24.121212
79
py
a3t-dev_richard
a3t-dev_richard/espnet2/schedulers/noam_lr.py
"""Noam learning rate scheduler module.""" from typing import Union import warnings import torch from torch.optim.lr_scheduler import _LRScheduler from typeguard import check_argument_types from espnet2.schedulers.abs_scheduler import AbsBatchStepScheduler class NoamLR(_LRScheduler, AbsBatchStepScheduler): """T...
2,078
30.5
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/schedulers/abs_scheduler.py
from abc import ABC from abc import abstractmethod import torch.optim.lr_scheduler as L class AbsScheduler(ABC): @abstractmethod def step(self, epoch: int = None): pass @abstractmethod def state_dict(self): pass @abstractmethod def load_state_dict(self, state): pass ...
1,679
18.764706
70
py
a3t-dev_richard
a3t-dev_richard/espnet2/schedulers/warmup_lr.py
"""Warm up learning rate scheduler module.""" from typing import Union import torch from torch.optim.lr_scheduler import _LRScheduler from typeguard import check_argument_types from espnet2.schedulers.abs_scheduler import AbsBatchStepScheduler class WarmupLR(_LRScheduler, AbsBatchStepScheduler): """The WarmupLR...
1,501
28.45098
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/utils/sized_dict.py
import collections import sys from torch import multiprocessing def get_size(obj, seen=None): """Recursively finds size of objects Taken from https://github.com/bosswissam/pysize """ size = sys.getsizeof(obj) if seen is None: seen = set() obj_id = id(obj) if obj_id in seen: ...
2,027
25.684211
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/utils/griffin_lim.py
#!/usr/bin/env python3 """Griffin-Lim related modules.""" # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import logging from distutils.version import LooseVersion from functools import partial from typeguard import check_argument_types from typing import Optional import...
5,592
28.282723
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/mlm.py
import argparse import logging from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union from pathlib import Path import copy import functools import yaml import numpy as np import torch from t...
26,037
37.234949
216
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/hubert.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 import argparse impor...
13,464
32.246914
85
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/enh_asr.py
import argparse import logging from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type from espnet2....
12,352
32.386486
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/diar.py
import argparse from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type from espnet2.asr.encoder.abs...
8,385
31.63035
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/asr.py
import argparse import logging from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type from espnet2....
16,312
33.271008
88
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/lm.py
import argparse import logging from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type from espnet2....
6,947
31.166667
84
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/tts.py
"""Text-to-speech task.""" import argparse import logging import yaml from pathlib import Path from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union import numpy as np import torch from ...
14,110
34.10199
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/enh.py
import argparse from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tuple import numpy as np import torch from typeguard import check_argument_types from typeguard import check_return_type from espnet2.enh.decoder.abs...
6,667
33.020408
86
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/gan_tts.py
# Copyright 2021 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """GAN-based text-to-speech task.""" import argparse import logging from typing import Callable from typing import Collection from typing import Dict from typing import List from typing import Optional from typing import Tupl...
13,631
32.087379
87
py
a3t-dev_richard
a3t-dev_richard/espnet2/tasks/abs_task.py
"""Abstract task module.""" from abc import ABC from abc import abstractmethod import argparse from dataclasses import dataclass from distutils.version import LooseVersion import functools import logging import os from pathlib import Path import sys from typing import Any from typing import Callable from typing import ...
67,592
36.406198
150
py
a3t-dev_richard
a3t-dev_richard/utils/generate_wav_from_fbank.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """This code is based on https://github.com/kan-bayashi/PytorchWaveNetVocoder.""" # Copyright 2019 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import logging import os import time import h5py import num...
6,061
30.572917
87
py
a3t-dev_richard
a3t-dev_richard/utils/average_checkpoints.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import json import os import numpy as np def main(): if args.log is not None: with open(args.log) as f: logs = json.load(f) val_scores = [] for log in logs: if log["epoch"] > args.max_epoch: ...
4,882
34.384058
88
py
a3t-dev_richard
a3t-dev_richard/egs/wsj/asr1/local/filtering_samples.py
#!/usr/bin/env python3 # Copyright 2020 Shanghai Jiao Tong University (Wangyou Zhang) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from functools import reduce import json from operator import mul import sys from espnet.bin.asr_train import get_parser from espnet.nets.pytorch_backend.nets_utils impor...
2,984
32.920455
86
py
a3t-dev_richard
a3t-dev_richard/aggregate_output/sedit_mcd.py
import types import sys # Having trouble importing sentencepiece for some reason... # Just mock it for now... sp = types.ModuleType("sentencepiece") sp.__spec__ = "spec" sys.modules["sentencepiece"] = sp import os from espnet2.bin.sedit_inference import * from espnet2.torch_utils.device_funcs import to_device import...
17,439
55.258065
405
py
a3t-dev_richard
a3t-dev_richard/aggregate_output/generate_spk2xv.py
import kaldiio,os from tqdm import tqdm import torch SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) datasets=['tr_no_dev','dev','eval1'] spk2xvector = {} for dataset in datasets: xv_path = f'{SCRIPT_DIR}/../egs2/vctk/tts1/dump/xvector/{dataset}/xvector.scp' new_xv_path = f'{SCRIPT_DIR}/../egs2/vctk/t...
1,684
38.186047
105
py
a3t-dev_richard
a3t-dev_richard/doc/conf.py
# -*- coding: utf-8 -*- # flake8: noqa # # ESPnet documentation build configuration file, created by # sphinx-quickstart on Thu Dec 7 15:46:00 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerat...
6,437
29.225352
83
py
a3t-dev_richard
a3t-dev_richard/egs2/TEMPLATE/ssl1/pyscripts/feature_loader.py
# -*- coding: utf-8 -*- # The feature_loader.py uses code from Fairseq: # https://github.com/pytorch/fairseq/blob/master/examples/hubert/simple_kmeans/dump_mfcc_feature.py # # Thanks to Abdelrahman Mohamed and Wei-Ning Hsu's help in this implementation, # Their origial Hubert work is in: # Paper: https://arxiv....
3,085
31.484211
103
py
a3t-dev_richard
a3t-dev_richard/egs2/TEMPLATE/ssl1/pyscripts/dump_km_label.py
import argparse import logging import os import sys import numpy as np import joblib import torch import tqdm import pdb from sklearn_km import (MfccFeatureReader, get_path_iterator, HubertFeatureReader) logging.basicConfig( level=logging.DEBUG, format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(m...
4,182
30.451128
85
py
a3t-dev_richard
a3t-dev_richard/egs2/TEMPLATE/ssl1/pyscripts/sklearn_km.py
# The sklearn_km.py uses code from Fairseq: # https://github.com/pytorch/fairseq/blob/master/examples/hubert/simple_kmeans/learn_kmeans.py # # 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...
6,468
27.879464
98
py
a3t-dev_richard
a3t-dev_richard/egs2/TEMPLATE/enh1/scripts/utils/calculate_speech_metrics.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 ...
7,370
32.657534
87
py
a3t-dev_richard
a3t-dev_richard/egs2/TEMPLATE/asr1/pyscripts/utils/plot_sinc_filters.py
#!/usr/bin/env python3 # 2020, Technische Universität München; Nicolas Lindae, Ludwig Kürzinger # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Visualize Sinc convolution filters. Description: This program loads a pretrained Sinc convolution of an ESPnet2 ASR model and plots filters, as well a...
11,743
32.65043
88
py
a3t-dev_richard
a3t-dev_richard/egs2/vctk/sedit/local/prepare_data_for_infer.py
import os from espnet2.bin.sedit_inference import * from espnet2.torch_utils.device_funcs import to_device import kaldiio import soundfile from tqdm import tqdm def save_wav_to_path(wav_input, left_index,right_index, path, prefix, sr,uid): wav_replaced = wav_input[left_index:right_index] wav_unreplaced = np.co...
4,988
53.228261
347
py
a3t-dev_richard
a3t-dev_richard/egs2/lrs2/lipreading1/local/feature_extract/video_processing.py
import skvideo.io import skimage.transform import face_alignment import numpy as np import cvtransforms import torch from models import pretrained def reload_model(model, path=""): if not bool(path): return model else: model_dict = model.state_dict() pretrained_dict = torch.load(path, ...
6,492
29.483568
88
py