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
VecConstNMT
VecConstNMT-master/fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.optim.lr_scheduler from . import register_lr_scheduler, LegacyFairseqLRScheduler @register_lr_scheduler('reduce_lr_on_plateau'...
4,755
41.088496
97
py
VecConstNMT
VecConstNMT-master/fairseq/optim/lr_scheduler/cosine_lr_scheduler.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from . import FairseqLRScheduler, register_lr_scheduler @register_lr_scheduler('cosine') class CosineSchedule(FairseqLRSchedule...
4,752
38.941176
105
py
VecConstNMT
VecConstNMT-master/fairseq/scoring/bleu.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ctypes import math import sys import torch from fairseq.scoring import register_scoring class BleuStat(ctypes.Structure): _fiel...
4,141
28.169014
91
py
VecConstNMT
VecConstNMT-master/fairseq/benchmark/dummy_model.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn as nn import torch.nn.functional as F from fairseq.data import Dictionary from fairseq.models import ( FairseqDecoder, ...
2,971
29.958333
78
py
VecConstNMT
VecConstNMT-master/fairseq/benchmark/dummy_mt.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import Dictionary, FairseqDataset from fairseq.tasks import register_task, ...
3,688
28.99187
84
py
VecConstNMT
VecConstNMT-master/fairseq/benchmark/dummy_masked_lm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import Dictionary, FairseqDataset from fairseq.tasks import register_task, ...
3,852
29.101563
84
py
VecConstNMT
VecConstNMT-master/fairseq/benchmark/dummy_lm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import Dictionary, FairseqDataset from fairseq.tasks import register_task, ...
3,544
28.789916
84
py
VecConstNMT
VecConstNMT-master/fairseq/data/language_pair_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch from fairseq.data import data_utils, FairseqDataset logger = logging.getLogger(__name__) ...
23,048
42.162921
116
py
VecConstNMT
VecConstNMT-master/fairseq/data/token_block_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from fairseq.data import FairseqDataset, plasma_utils class TokenBlockDataset(FairseqDataset): """Break...
5,966
34.730539
101
py
VecConstNMT
VecConstNMT-master/fairseq/data/subsample_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np from . import BaseWrapperDataset logger = logging.getLogger(__name__) class SubsampleDataset(BaseWrapp...
2,103
28.222222
101
py
VecConstNMT
VecConstNMT-master/fairseq/data/prepend_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class PrependDataset(BaseWrapperDataset): def __init__(self, dataset, ...
953
31.896552
83
py
VecConstNMT
VecConstNMT-master/fairseq/data/base_wrapper_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from torch.utils.data.dataloader import default_collate from . import FairseqDataset class BaseWrapperDataset(FairseqDataset): def __i...
2,154
25.9375
70
py
VecConstNMT
VecConstNMT-master/fairseq/data/raw_label_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class RawLabelDataset(FairseqDataset): def __init__(self, labels): super().__init__(...
547
20.92
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/resampling_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np from fairseq.data import BaseWrapperDataset, plasma_utils logger = logging.getLogger(__name__) class R...
4,317
29.624113
78
py
VecConstNMT
VecConstNMT-master/fairseq/data/dictionary.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from collections import Counter from multiprocessing import Pool import torch from fairseq import utils from fairseq.binarizer impo...
12,599
31.390746
87
py
VecConstNMT
VecConstNMT-master/fairseq/data/append_token_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class AppendTokenDataset(BaseWrapperDataset): def __init__(self, data...
1,066
23.813953
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/fasta_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(prefix_path): ...
3,387
30.37037
107
py
VecConstNMT
VecConstNMT-master/fairseq/data/mask_tokens_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from functools import lru_cache import numpy as np import torch from fairseq.data import data_utils, Dictionary from . import BaseWrapperDa...
6,973
38.179775
87
py
VecConstNMT
VecConstNMT-master/fairseq/data/concat_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import bisect import numpy as np from torch.utils.data.dataloader import default_collate from . import FairseqDataset class ConcatDataset(...
4,619
36.560976
93
py
VecConstNMT
VecConstNMT-master/fairseq/data/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. try: from collections.abc import Iterable except ImportError: from collections import Iterable import contextlib import itertools impo...
17,213
37.77027
120
py
VecConstNMT
VecConstNMT-master/fairseq/data/nested_dictionary_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict import torch from torch.utils.data.dataloader import default_collate from . import FairseqDataset def ...
3,926
31.454545
86
py
VecConstNMT
VecConstNMT-master/fairseq/data/add_target_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset from . import data_utils class AddTargetDataset(BaseWrapperDataset): def __init__(self, d...
2,046
35.553571
107
py
VecConstNMT
VecConstNMT-master/fairseq/data/transform_eos_lang_pair_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import FairseqDataset import torch from typing import Optional class TransformEosLangPairDataset(FairseqDataset): """A :class:`~...
3,381
36.577778
110
py
VecConstNMT
VecConstNMT-master/fairseq/data/lm_context_window_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from fairseq.data.monolingual_dataset import MonolingualDataset from . import FairseqDataset class LMConte...
2,910
35.848101
90
py
VecConstNMT
VecConstNMT-master/fairseq/data/colorize_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset class ColorizeDataset(BaseWrapperDataset): """ Adds 'colors' property to net input that i...
844
32.8
113
py
VecConstNMT
VecConstNMT-master/fairseq/data/iterators.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import logging import math import operator import os import queue import time from threading import Thread import numpy as n...
19,023
33.715328
94
py
VecConstNMT
VecConstNMT-master/fairseq/data/backtranslation_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq import utils from . import FairseqDataset def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True)...
6,235
36.566265
93
py
VecConstNMT
VecConstNMT-master/fairseq/data/monolingual_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import data_utils, FairseqDataset def collate(samples, pad_idx, eos_idx): if len(samples) == 0: ...
9,109
37.117155
117
py
VecConstNMT
VecConstNMT-master/fairseq/data/roll_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import BaseWrapperDataset class RollDataset(BaseWrapperDataset): def __init__(self, dataset, shifts): supe...
486
23.35
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/replace_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import BaseWrapperDataset class ReplaceDataset(BaseWrapperDataset): """Replaces tokens found in the dataset by a specified replac...
1,394
36.702703
117
py
VecConstNMT
VecConstNMT-master/fairseq/data/id_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class IdDataset(FairseqDataset): def __getitem__(self, index): return index def...
424
19.238095
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/indexed_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from functools import lru_cache import os import shutil import struct import numpy as np import torch from . import FairseqDataset from fair...
17,020
30.173993
105
py
VecConstNMT
VecConstNMT-master/fairseq/data/denoising_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch import math from . import data_utils, FairseqDataset def collate( samples, pad_idx, eos_idx, ...
15,236
35.98301
118
py
VecConstNMT
VecConstNMT-master/fairseq/data/prepend_token_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class PrependTokenDataset(BaseWrapperDataset): def __init__(self, dat...
1,067
23.837209
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/numel_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from . import BaseWrapperDataset class NumelDataset(BaseWrapperDataset): def __init__(self, dataset, r...
787
22.878788
65
py
VecConstNMT
VecConstNMT-master/fairseq/data/token_label_block_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch from fairseq.data import FairseqDataset, plasma_utils class TokenLabelBlockDataset(FairseqDataset): """...
6,003
34.952096
101
py
VecConstNMT
VecConstNMT-master/fairseq/data/noising.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import numpy as np from fairseq.data import data_utils class WordNoising(object): """Generate a noisy version of a sentenc...
12,184
37.560127
110
py
VecConstNMT
VecConstNMT-master/fairseq/data/bucket_pad_length_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch.nn.functional as F from fairseq.data import BaseWrapperDataset class BucketPadLengthDataset(BaseWrapperData...
2,261
28
79
py
VecConstNMT
VecConstNMT-master/fairseq/data/concat_sentences_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class ConcatSentencesDataset(FairseqDataset): def __init__(self, *datasets): super()...
1,573
26.614035
75
py
VecConstNMT
VecConstNMT-master/fairseq/data/fairseq_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import torch.utils.data from fairseq.data import data_utils class EpochListening: """Mixin for receiving updates whe...
6,291
34.348315
100
py
VecConstNMT
VecConstNMT-master/fairseq/data/transform_eos_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from . import FairseqDataset class TransformEosDataset(FairseqDataset): """A :class:`~fairseq.data.FairseqDataset` wrapper...
4,576
36.516393
88
py
VecConstNMT
VecConstNMT-master/fairseq/data/multilingual/sampled_multi_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import List from enum import Enum from collections import OrderedDict from collections import defaultdict from bisect import bisec...
17,170
40.677184
119
py
VecConstNMT
VecConstNMT-master/fairseq/data/multilingual/multilingual_utils.py
from enum import Enum from typing import Dict, List, Optional, Sequence import torch from fairseq.data import Dictionary class EncoderLangtok(Enum): """ Prepend to the beginning of source sentence either the source or target language token. (src/tgt). """ src = "src" tgt = "tgt" class Lang...
1,623
24.375
85
py
VecConstNMT
VecConstNMT-master/fairseq/data/multilingual/sampled_multi_epoch_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import hashlib import math import logging import numpy as np from fairseq.data import SampledMultiDataset from .sampled_multi_dataset import ...
7,488
42.04023
119
py
VecConstNMT
VecConstNMT-master/fairseq/data/audio/raw_audio_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import logging import numpy as np import sys import torch import torch.nn.functional as F from .. import FairseqDataset logger =...
5,341
28.351648
88
py
VecConstNMT
VecConstNMT-master/fairseq/data/encoders/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq.data import encoders def get_whole_word_mask(args, dictionary): bpe = encoders.build_bpe(args) if bpe is n...
907
30.310345
67
py
VecConstNMT
VecConstNMT-master/fairseq/data/legacy/block_pair_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import numpy as np import torch from fairseq.data import FairseqDataset class BlockPairDataset(FairseqDataset): """Break a...
12,878
40.146965
99
py
VecConstNMT
VecConstNMT-master/fairseq/data/legacy/masked_lm_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import numpy as np import torch from typing import Dict, List, Tuple from fairseq.data import FairseqDataset, data_utils from ...
12,468
37.603715
83
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/translation_from_pretrained_bart.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq.data import LanguagePairDataset from fairseq import utils from .translation import load_langpair_dataset, Translat...
5,522
42.488189
108
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/language_modeling.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import numpy as np import torch from fairseq import utils from fairseq.data import ( AppendTokenDataset, da...
18,496
41.230594
149
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/translation.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from argparse import Namespace import json import itertools import logging import os from fairseq import options import numpy as np from fair...
20,348
44.831081
108
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/multilingual_masked_lm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import numpy as np import torch from fairseq.data import ( data_utils, Dictionary, encoders, Concat...
11,909
38.437086
98
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/multilingual_translation.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from collections import OrderedDict import logging import os from fairseq import options import contextlib import torch from fairseq import m...
15,955
43.077348
117
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/translation_lev.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch from fairseq.data import LanguagePairDataset from fairseq.utils import new_arange from fairseq.tasks import register...
7,220
40.5
108
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/fairseq_task.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os import warnings import torch from fairseq import metrics, search, tokenizer, utils from fairseq.data import data_u...
20,274
36.338858
109
py
VecConstNMT
VecConstNMT-master/fairseq/tasks/translation_multi_simple_epoch.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import datetime import time import torch from fairseq.data import ( data_utils, FairseqDataset, iterators, Lan...
15,631
41.363144
117
py
VecConstNMT
VecConstNMT-master/docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # fairseq documentation build configuration file, created by # sphinx-quickstart on Fri Aug 17 21:45:30 2018. # # 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 # au...
4,235
30.849624
80
py
VecConstNMT
VecConstNMT-master/fairseq_cli/generate.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Translate pre-processed data with a trained model. """ import logging import math import os import sys import n...
11,457
38.510345
192
py
VecConstNMT
VecConstNMT-master/fairseq_cli/eval_tlm.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import sys impor...
5,579
31.068966
83
py
VecConstNMT
VecConstNMT-master/fairseq_cli/validate.py
#!/usr/bin/env python3 -u #!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from itertools import chain import logging import os import sys import torch from fairse...
4,389
31.518519
88
py
VecConstNMT
VecConstNMT-master/fairseq_cli/eval_lm.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import sys impor...
9,000
33.224335
112
py
VecConstNMT
VecConstNMT-master/fairseq_cli/interactive.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Translate raw text with a trained model. Batches data on-the-fly. """ from collections import namedtuple import ...
10,427
35.083045
126
py
VecConstNMT
VecConstNMT-master/fairseq_cli/train.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Train a new model on one or across multiple GPUs. """ import argparse import logging import math import os impor...
12,826
32.933862
93
py
a3t-dev_richard
a3t-dev_richard/setup.py
#!/usr/bin/env python3 """ESPnet setup script.""" import os from distutils.version import LooseVersion from setuptools import find_packages from setuptools import setup requirements = { "install": [ "setuptools>=38.5.1", "configargparse>=1.2.1", "typeguard>=2.7.0", "humanfriendl...
6,120
34.178161
87
py
a3t-dev_richard
a3t-dev_richard/tools/check_pytorch_cuda_compatibility.py
#!/usr/bin/env python import argparse from distutils.version import LooseVersion import warnings def check(pytorch_version: str, cuda_version: str): # NOTE(kamo): Supported cuda version is defined # as existing prebuilt binaries in # https://anaconda.org/pytorch/pytorch/files # You probably could per...
2,999
34.294118
89
py
a3t-dev_richard
a3t-dev_richard/tools/check_install.py
#!/usr/bin/env python3 """Script to check whether the installation is done correctly.""" # Copyright 2018 Nagoya University (Tomoki Hayashi) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import importlib import shutil import sys from distutils.version import LooseVersion module_list = [ ("torchau...
4,169
28.160839
83
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_compatibility.py
#!/usr/bin/env python3 # coding: utf-8 # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import print_function import importlib import os from os.path import join import re import shutil import subprocess import tempfile import chainer import numpy as np imp...
3,585
30.734513
111
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr_conformer.py
import argparse import pytest import torch from espnet.nets.pytorch_backend.e2e_asr_conformer import E2E from espnet.nets.pytorch_backend.transformer import plot def make_arg(**kwargs): defaults = dict( adim=2, aheads=1, dropout_rate=0.0, transformer_attn_dropout_rate=None, ...
4,493
25.91018
83
py
a3t-dev_richard
a3t-dev_richard/test/test_custom_transducer.py
# coding: utf-8 import argparse import tempfile import json import pytest import torch from espnet.asr.pytorch_backend.asr_init import load_trained_model import espnet.lm.pytorch_backend.extlm as extlm_pytorch from espnet.nets.beam_search_transducer import BeamSearchTransducer from espnet.nets.pytorch_backend.e2e_as...
16,316
29.728814
87
py
a3t-dev_richard
a3t-dev_richard/test/test_batch_beam_search.py
from argparse import Namespace import numpy import os import pytest import torch from espnet.nets.batch_beam_search import BatchBeamSearch from espnet.nets.batch_beam_search import BeamSearch from espnet.nets.beam_search import Hypothesis from espnet.nets.lm_interface import dynamic_import_lm from espnet.nets.scorers...
5,938
29.932292
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_mt.py
# coding: utf-8 # Copyright 2019 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division import argparse import importlib import os import tempfile import chainer import numpy as np import pytest import torch from espnet.nets.pytorch_backend.nets_utils import pa...
12,863
31.321608
88
py
a3t-dev_richard
a3t-dev_richard/test/test_multi_spkrs.py
# coding: utf-8 # Copyright 2018 Hiroshi Seki # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import importlib import numpy import re import torch import pytest def make_arg(**kwargs): defaults = dict( aconv_chans=10, aconv_filts=100, adim=320, aheads...
7,267
28.544715
86
py
a3t-dev_richard
a3t-dev_richard/test/test_positional_encoding.py
import pytest import torch from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding from espnet.nets.pytorch_backend.transformer.embedding import ScaledPositionalEncoding @pytest.mark.parametrize( "dtype, device", [(dt, dv) for dt in ("float32", "float64") for dv in ("cpu", "cuda")], ...
4,331
31.328358
87
py
a3t-dev_richard
a3t-dev_richard/test/test_asr_init.py
# coding: utf-8 import argparse import json import os import tempfile import numpy as np import pytest import torch import espnet.nets.pytorch_backend.lm.default as lm_pytorch from espnet.asr.asr_utils import torch_save from espnet.asr.pytorch_backend.asr_init import freeze_modules from espnet.asr.pytorch_backend.a...
7,631
25.968198
82
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_mt_transformer.py
# coding: utf-8 # Copyright 2019 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import pytest import torch from espnet.nets.pytorch_backend.e2e_mt_transformer import E2E from espnet.nets.pytorch_backend.transformer import plot def make_arg(**kwargs): defaults = dic...
3,753
26.202899
83
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr_transformer.py
import argparse import chainer import numpy import pytest import torch import espnet.nets.chainer_backend.e2e_asr_transformer as ch import espnet.nets.pytorch_backend.e2e_asr_transformer as th from espnet.nets.pytorch_backend.nets_utils import rename_state_dict from espnet.nets.pytorch_backend.transformer.add_sos_eos ...
8,202
30.190114
87
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_tts_transformer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import pytest import torch from argparse import Namespace from espnet.nets.pytorch_backend.e2e_tts_transformer import subsequent_mask from espnet.nets.pytorch...
15,668
32.409382
88
py
a3t-dev_richard
a3t-dev_richard/test/test_asr_interface.py
import pytest from espnet.nets.asr_interface import dynamic_import_asr @pytest.mark.parametrize( "name, backend", [(nn, backend) for nn in ("transformer", "rnn") for backend in ("pytorch",)], ) def test_asr_build(name, backend): model = dynamic_import_asr(name, backend).build( 10, 10, mtlalpha=0....
415
26.733333
81
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr.py
# coding: utf-8 # Copyright 2017 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division import argparse import importlib import os import tempfile import chainer import numpy as np import pytest import torch from espnet.asr import asr_utils import espnet.nets.cha...
26,920
34.329396
88
py
a3t-dev_richard
a3t-dev_richard/test/test_asr_quantize.py
# Copyright 2021 Gaopeng Xu # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import torch from espnet.nets.asr_interface import dynamic_import_asr @pytest.mark.parametrize( "name, backend", [(nn, backend) for nn in ("transformer", "rnn") for backend in ("pytorch",)], ) def test_asr_...
642
28.227273
81
py
a3t-dev_richard
a3t-dev_richard/test/test_optimizer.py
# coding: utf-8 # Copyright 2017 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import chainer import numpy import pytest import torch from espnet.optimizer.factory import dynamic_import_optimizer from espnet.optimizer.pytorch import OPTIMIZER_FACTORY_DICT class ChModel(chainer.Chain): ...
3,023
29.857143
83
py
a3t-dev_richard
a3t-dev_richard/test/test_loss.py
# Copyright 2017 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import chainer.functions as F import numpy import pytest import torch from espnet.nets.pytorch_backend.e2e_asr import pad_list from espnet.nets.pytorch_backend.nets_utils import th_accuracy @pytest.mark.parametrize("ctc_type"...
5,646
35.668831
86
py
a3t-dev_richard
a3t-dev_richard/test/test_beam_search.py
from argparse import Namespace import numpy import pytest import torch from espnet.nets.asr_interface import dynamic_import_asr from espnet.nets.beam_search import BeamSearch from espnet.nets.lm_interface import dynamic_import_lm from espnet.nets.scorers.length_bonus import LengthBonus rnn_args = Namespace( elay...
6,366
27.55157
88
py
a3t-dev_richard
a3t-dev_richard/test/test_lm.py
import chainer import numpy import pytest import torch import espnet.lm.chainer_backend.lm as lm_chainer from espnet.nets.beam_search import beam_search from espnet.nets.lm_interface import dynamic_import_lm import espnet.nets.pytorch_backend.lm.default as lm_pytorch from espnet.nets.scorers.length_bonus import Length...
6,680
33.261538
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_tts_fastspeech.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import json import os import shutil import tempfile from argparse import Namespace import numpy as np import pytest import torch from espnet.nets.pytorch_backend.e2e_tts_fastsp...
21,141
32.347003
87
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_st_transformer.py
# coding: utf-8 # Copyright 2019 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import pytest import torch from espnet.nets.pytorch_backend.e2e_st_transformer import E2E from espnet.nets.pytorch_backend.transformer import plot def make_arg(**kwargs): defaults = dict...
5,351
28.899441
85
py
a3t-dev_richard
a3t-dev_richard/test/test_torch.py
# Copyright 2017 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import torch from espnet.nets.pytorch_backend.nets_utils import pad_list def test_pad_list(): xs = [[1, 2, 3], [1, 2], [1, 2, 3, 4]] xs = list(map(lambda x: torch.LongTensor(x), xs)) xpad = pad_list(xs, -1) e...
852
26.516129
74
py
a3t-dev_richard
a3t-dev_richard/test/test_initialization.py
# Copyright 2017 Shigeki Karita # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import os import random import numpy import torch args = argparse.Namespace( elayers=4, subsample="1_2_2_1_1", etype="vggblstmp", eunits=320, eprojs=320, dtype="lstm", dlayers=2, ...
3,385
28.443478
72
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_st.py
# coding: utf-8 # Copyright 2019 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division import argparse import importlib import os import tempfile import chainer import numpy as np import pytest import torch from espnet.nets.pytorch_backend.nets_utils import pa...
20,478
33.651438
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr_maskctc.py
import argparse import pytest import torch from espnet.nets.pytorch_backend.e2e_asr_maskctc import E2E from espnet.nets.pytorch_backend.maskctc.add_mask_token import mask_uniform from espnet.nets.pytorch_backend.transformer import plot def make_arg(**kwargs): defaults = dict( adim=2, aheads=2, ...
3,707
27.744186
83
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr_transducer.py
# coding: utf-8 import argparse import tempfile import json import numpy as np import pytest import torch from espnet.asr.pytorch_backend.asr_init import load_trained_model import espnet.lm.pytorch_backend.extlm as extlm_pytorch from espnet.nets.beam_search_transducer import BeamSearchTransducer from espnet.nets.pyt...
11,607
28.461929
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_vc_transformer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Wen-Chin Huang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from math import floor import numpy as np import pytest import torch from argparse import Namespace from espnet.nets.pytorch_backend.e2e_vc_transformer import subsequent_mask fr...
16,087
32.727463
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_asr_mulenc.py
# coding: utf-8 # Copyright 2019 Ruizhi Li # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division import argparse import importlib import os import tempfile import numpy as np import pytest import torch from espnet.nets.pytorch_backend.nets_utils import pad_list from espnet.uti...
21,858
35.431667
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_vc_tacotron2.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2020 Wen-Chin Huang # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import print_function from __future__ import division import numpy as np import pytest import torch from argparse import Namespace from espnet.nets.pytorch_back...
8,660
27.396721
88
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_tts_tacotron2.py
#!/usr/bin/env python3 # Copyright 2019 Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import print_function from __future__ import division import numpy as np import pytest import torch from argparse import Namespace from espnet.nets.pytorch_backend.e2e_tts_tacotron2 im...
8,820
27.63961
88
py
a3t-dev_richard
a3t-dev_richard/test/test_train_dtype.py
import pytest import torch from espnet.nets.asr_interface import dynamic_import_asr @pytest.mark.parametrize( "dtype, device, model, conf", [ (dtype, device, nn, conf) for nn, conf in [ ( "transformer", dict(adim=4, eunits=3, dunits=3, elayers=2, dl...
2,795
28.125
85
py
a3t-dev_richard
a3t-dev_richard/test/test_transformer_decode.py
import numpy import pytest import torch from espnet.nets.pytorch_backend.transformer.decoder import Decoder from espnet.nets.pytorch_backend.transformer.encoder import Encoder from espnet.nets.pytorch_backend.transformer.mask import subsequent_mask RTOL = 1e-4 @pytest.mark.parametrize("normalize_before", [True, Fa...
4,487
29.951724
85
py
a3t-dev_richard
a3t-dev_richard/test/test_recog.py
# coding: utf-8 # Copyright 2018 Hiroshi Seki # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import numpy import pytest import torch import espnet.lm.pytorch_backend.extlm as extlm_pytorch from espnet.nets.pytorch_backend import e2e_asr import espnet.nets.pytorch_backend.lm.default as l...
4,644
28.967742
87
py
a3t-dev_richard
a3t-dev_richard/test/test_scheduler.py
from espnet.scheduler.chainer import ChainerScheduler from espnet.scheduler.pytorch import PyTorchScheduler from espnet.scheduler import scheduler import chainer import numpy import pytest import torch @pytest.mark.parametrize("name", scheduler.SCHEDULER_DICT.keys()) def test_scheduler(name): s = scheduler.dynam...
1,247
26.130435
65
py
a3t-dev_richard
a3t-dev_richard/test/test_e2e_st_conformer.py
# coding: utf-8 # Copyright 2019 Hirofumi Inaguma # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import argparse import pytest import torch from espnet.nets.pytorch_backend.e2e_st_conformer import E2E from espnet.nets.pytorch_backend.transformer import plot def make_arg(**kwargs): defaults = dict( ...
4,215
26.555556
85
py