repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/eval_latency.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 examples.simultaneous_translation.utils.latency import LatencyInference import argparse import torch import json LATENCY_METRICS = [ ...
2,432
29.037037
85
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/client.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 requests from typing import Optional from scorers import build_scorer class SimulSTEvaluationService(object): DEFAULT_HOSTNAME = ...
3,056
28.679612
80
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/__init__.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.
177
34.6
65
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/scorers/scorer.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 vizseq.scorers.bleu import BLEUScorer from vizseq.scorers.ter import TERScorer from vizseq.scorers.meteor import METEORScorer from exampl...
6,141
32.2
82
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/scorers/__init__.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 importlib import os from fairseq import registry ( build_scorer, register_scorer, SCORER_REGISTRIES ) = registry.setup_regi...
546
27.789474
65
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/scorers/text_scorer.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 . scorer import SimulScorer from . import register_scorer @register_scorer("text") class SimulTextScorer(SimulScorer): def __init__...
1,302
30.02381
73
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/agents/simul_trans_text_agent.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 . simul_trans_agent import SimulTransAgent from . import DEFAULT_EOS, GET from . import register_agent from . word_splitter import SPLITT...
2,614
32.101266
77
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/agents/word_splitter.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. class SubwordSplitter(object): def process_line(self, string): raise NotImplementedError def split(self, string): ra...
2,331
24.911111
87
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/agents/simul_trans_agent.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 . agent import Agent from . import DEFAULT_EOS, GET, SEND from fairseq import checkpoint_utils, utils, tasks import os import json clas...
5,890
34.920732
99
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/agents/agent.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 GET, SEND, DEFAULT_EOS import time from multiprocessing.pool import ThreadPool as Pool from functools import partial class Age...
2,007
29.424242
70
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/eval/agents/__init__.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 importlib import os from fairseq import registry build_agent, register_agent, MONOTONIC_AGENT = registry.setup_registry('--agent-type'...
565
25.952381
86
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/criterions/label_smoothed_cross_entropy_latency_augmented.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 fairseq.criterions import register_criterion from fairseq.criterions.label_smoothed_cross_entropy import ( LabelSmoothedCrossEntropyC...
3,080
39.012987
98
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/criterions/__init__.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 importlib import os for file in os.listdir(os.path.dirname(__file__)): if file.endswith(".py") and not file.startswith("_"): ...
485
31.4
76
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/models/__init__.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 importlib import os for file in os.listdir(os.path.dirname(__file__)): if file.endswith('.py') and not file.startswith('_'): ...
450
33.692308
89
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/models/transformer_monotonic_attention.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 torch.nn as nn import torch.nn.functional as F from fairseq.models import ( register_model, register_model_archit...
11,249
30.163435
95
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/utils/functions.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 def exclusive_cumprod(tensor, dim: int, eps: float = 1e-10): """ Implementing exclusive cumprod. There is cumprod i...
3,908
25.773973
95
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/utils/latency.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 class LatencyMetric(object): @staticmethod def length_from_padding_mask(padding_mask, batch_first: bool = False): ...
14,598
32.407323
110
py
RegularizedBN
RegularizedBN-main/examples/simultaneous_translation/utils/__init__.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 importlib import os # automatically import any Python files in the criterions/ directory for file in os.listdir(os.path.dirname(__fil...
511
33.133333
84
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_score_bw.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 contextlib import redirect_stdout import os from fairseq import options from fairseq_cli import generate from . import rerank_options, ...
4,369
41.843137
116
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_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. """ Generate n-best translations using a trained model. """ from contextlib import redirect_stdout import os import...
13,197
52.650407
118
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_score_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 os from fairseq import options from . import rerank_options, rerank_utils def score_lm(args): using_nbest = args.nbest_list is ...
2,117
37.509091
118
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/__init__.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 .rerank_options import * # noqa
216
30
65
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank.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 multiprocessing import Pool import numpy as np from fairseq import options from fairseq.data import dictionary from fairseq...
12,842
42.388514
125
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_options.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 fairseq import options def get_reranking_parser(default_task='translation'): parser = options.get_parser('Generation and reranking'...
7,452
57.685039
117
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_tune.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 argparse import random import numpy as np from fairseq import options from . import rerank, rerank_options def random_search(args):...
3,034
31.287234
103
py
RegularizedBN
RegularizedBN-main/examples/noisychannel/rerank_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. from contextlib import redirect_stdout import math import os import re import subprocess from fairseq import options from fairseq_cli import ...
27,676
41.449387
119
py
RegularizedBN
RegularizedBN-main/examples/paraphraser/paraphrase.py
#!/usr/bin/env python3 -u import argparse import fileinput import logging import os import sys from fairseq.models.transformer import TransformerModel logging.getLogger().setLevel(logging.INFO) def main(): parser = argparse.ArgumentParser(description='') parser.add_argument('--en2fr', required=True, ...
2,422
30.467532
86
py
RegularizedBN
RegularizedBN-main/examples/constrained_decoding/tok.py
#!/usr/bin/env python3 # # 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 sys import sacremoses def main(args): """Tokenizes, preserving tabs""" mt = sacremoses.MosesTokenize...
841
25.3125
68
py
RegularizedBN
RegularizedBN-main/examples/constrained_decoding/normalize.py
#!/usr/bin/env python3 # # 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 sys from sacremoses.normalize import MosesPunctNormalizer def main(args): normalizer = MosesPunctNormal...
697
24.851852
69
py
RegularizedBN
RegularizedBN-main/examples/megatron_11b/detok.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. import argparse import fileinput import sacremoses def main(): parser = argparse.ArgumentParser(description=''...
733
28.36
150
py
RegularizedBN
RegularizedBN-main/scripts/count_docs.py
#!/usr/bin/env python3 # 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. """ Count the number of documents and average number of lines and tokens per document in a large file. Documents should ...
1,784
29.254237
79
py
RegularizedBN
RegularizedBN-main/scripts/read_binarized.py
#!/usr/bin/env python3 # 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 argparse from fairseq.data import data_utils, Dictionary, indexed_dataset def get_parser(): parser = argp...
1,365
27.458333
103
py
RegularizedBN
RegularizedBN-main/scripts/compare_namespaces.py
#!/usr/bin/env python """Helper script to compare two argparse.Namespace objects.""" from argparse import Namespace # noqa def main(): ns1 = eval(input('Namespace 1: ')) ns2 = eval(input('Namespace 2: ')) def keys(ns): ks = set() for k in dir(ns): if not k.startswith('_'): ...
1,052
22.4
91
py
RegularizedBN
RegularizedBN-main/scripts/split_train_valid_docs.py
#!/usr/bin/env python3 # 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. """ Split a large file into a train and valid set while respecting document boundaries. Documents should be separated by...
2,561
28.790698
71
py
RegularizedBN
RegularizedBN-main/scripts/average_checkpoints.py
#!/usr/bin/env python3 # 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 argparse import collections import torch import os import re from fairseq.file_io import PathManager def aver...
6,012
38.821192
175
py
RegularizedBN
RegularizedBN-main/scripts/build_sym_alignment.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. """ Use this script in order to build symmetric alignments for your translation dataset. This script depends on fast_align and mosesdecoder too...
3,806
37.846939
116
py
RegularizedBN
RegularizedBN-main/scripts/spm_decode.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import argparse ...
1,509
30.458333
83
py
RegularizedBN
RegularizedBN-main/scripts/rm_pt.py
#!/usr/bin/env python3 # 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 argparse import os import re import shutil import sys pt_regexp = re.compile(r'checkpoint(\d+|_\d+_\d+|_[a-z]+...
4,772
34.887218
112
py
RegularizedBN
RegularizedBN-main/scripts/__init__.py
0
0
0
py
RegularizedBN
RegularizedBN-main/scripts/spm_train.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import sys impor...
431
24.411765
82
py
RegularizedBN
RegularizedBN-main/scripts/shard_docs.py
#!/usr/bin/env python3 # 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. """ Split a large file into shards while respecting document boundaries. Documents should be separated by a single empty...
1,576
28.754717
96
py
RegularizedBN
RegularizedBN-main/scripts/spm_encode.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import argparse i...
3,411
33.12
84
py
RegularizedBN
RegularizedBN-main/scripts/constraints/validate.py
#!/usr/bin/env python3 # # 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 sys """Reads in a fairseq output file, and verifies that the constraints (C- lines) are present in the output...
930
26.382353
70
py
RegularizedBN
RegularizedBN-main/scripts/constraints/extract.py
#!/usr/bin/env python3 # # 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. """Extracts random constraints from reference files.""" import argparse import random import sys from sacrebleu impo...
2,827
32.666667
101
py
RegularizedBN
RegularizedBN-main/tests/test_inference_dropout.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 unittest from tests.test_sequence_generator import get_dummy_task_and_parser from fairseq.models.transformer import Tra...
3,057
46.046154
92
py
RegularizedBN
RegularizedBN-main/tests/test_train.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 contextlib import logging import unittest from io import StringIO from unittest.mock import MagicMock, patch import torch from fairse...
8,428
40.318627
110
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest from fairseq.data import iterators class TestIterators(unittest.TestCase): def test_counting_iterator(self, ref=None, ...
3,326
35.56044
87
py
RegularizedBN
RegularizedBN-main/tests/test_average_checkpoints.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 collections import os import tempfile import unittest import shutil import numpy as np import torch from torch import nn from script...
4,494
30.215278
80
py
RegularizedBN
RegularizedBN-main/tests/test_reproducibility.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 contextlib from io import StringIO import json import os import tempfile import unittest import torch from . import test_binaries c...
3,864
36.163462
97
py
RegularizedBN
RegularizedBN-main/tests/test_sequence_scorer.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 argparse import unittest import torch from fairseq.sequence_scorer import SequenceScorer import tests.utils as test_utils class Te...
3,949
33.051724
75
py
RegularizedBN
RegularizedBN-main/tests/test_memory_efficient_fp16.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 argparse import logging import unittest import torch from fairseq.optim.adam import FairseqAdam from fairseq.optim.fp16_optimizer imp...
2,002
28.028986
70
py
RegularizedBN
RegularizedBN-main/tests/test_file_io.py
# This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys import tempfile import os import shutil from typing import Optional import unittest from unittest.mock import MagicMock class TestFileIO(unittest.TestCase): _tmpdir: Optional[...
1,415
28.5
80
py
RegularizedBN
RegularizedBN-main/tests/test_lstm_jitable.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 argparse import tempfile import unittest import torch from fairseq.data.dictionary import Dictionary from fairseq.models.lstm import L...
3,995
34.052632
99
py
RegularizedBN
RegularizedBN-main/tests/test_multihead_attention.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 unittest from fairseq.modules.multihead_attention import MultiheadAttention class TestMultiheadAttention(unittest.TestCa...
1,904
30.229508
80
py
RegularizedBN
RegularizedBN-main/tests/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 argparse import os import random import sys import torch import torch.nn.functional as F from io import StringIO from fairseq import o...
16,382
32.09697
107
py
RegularizedBN
RegularizedBN-main/tests/test_binaries.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 contextlib from io import StringIO import logging import os import random import tempfile import unittest import torch from fairseq i...
40,028
40.959119
122
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest import torch from fairseq.data import LanguagePairDataset, TokenBlockDataset from fairseq.data.concat_dataset import ConcatDa...
1,943
28.907692
66
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest from typing import Dict, List import tests.utils as test_utils import torch from fairseq import utils from fairseq.data impor...
19,779
36.533207
87
py
RegularizedBN
RegularizedBN-main/tests/test_constraints.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 sys import torch import unittest from fairseq.token_generation_constraints import * def tensorize(constraints: List[List[int]]) -> t...
10,242
39.168627
204
py
RegularizedBN
RegularizedBN-main/tests/test_sparse_multihead_attention.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 unittest from fairseq.modules.sparse_multihead_attention import SparseMultiheadAttention class TestSparseMultiheadAttent...
2,545
50.959184
114
py
RegularizedBN
RegularizedBN-main/tests/test_export.py
#!/usr/bin/env python3 # 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 argparse import tempfile import unittest import torch from fairseq.data.dictionary import Dictionary from fairs...
3,499
31.110092
86
py
RegularizedBN
RegularizedBN-main/tests/test_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 collections import unittest import numpy as np from fairseq.data import ListDataset, ResamplingDataset class TestResamplingDataset(...
3,366
31.066667
77
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest import torch from fairseq.data import ( BacktranslationDataset, LanguagePairDataset, TransformEosDataset, ) from...
4,030
33.452991
90
py
RegularizedBN
RegularizedBN-main/tests/test_fp16_optimizer.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 argparse import copy import unittest import torch from fairseq.optim.fp16_optimizer import FP16Optimizer, MemoryEfficientFP16Optimize...
2,720
33.884615
129
py
RegularizedBN
RegularizedBN-main/tests/__init__.py
0
0
0
py
RegularizedBN
RegularizedBN-main/tests/test_metrics.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 unittest import uuid from fairseq import metrics class TestMetrics(unittest.TestCase): def test_nesting(self): with met...
2,638
32.405063
72
py
RegularizedBN
RegularizedBN-main/tests/test_sequence_generator.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 argparse import tempfile import unittest import tests.utils as test_utils import torch from fairseq import search from fairseq.data.di...
23,549
38.780405
102
py
RegularizedBN
RegularizedBN-main/tests/test_label_smoothing.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 argparse import copy import unittest import torch from fairseq.criterions.cross_entropy import CrossEntropyCriterion from fairseq.cri...
4,235
41.36
101
py
RegularizedBN
RegularizedBN-main/tests/test_convtbc.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 unittest from fairseq.modules import ConvTBC import torch.nn as nn class TestConvTBC(unittest.TestCase): def test_c...
1,679
33.285714
102
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest import torch from fairseq.data import TokenBlockDataset import tests.utils as test_utils class TestTokenBlockDataset(unit...
2,970
36.607595
89
py
RegularizedBN
RegularizedBN-main/tests/test_multi_corpus_sampled_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 unittest from collections import OrderedDict import numpy as np import torch from fairseq.data import LanguagePairDataset, TokenBlockD...
3,105
31.354167
79
py
RegularizedBN
RegularizedBN-main/tests/test_bmuf.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 argparse from multiprocessing import Manager import random import unittest import torch import torch.nn as nn from fairseq import dis...
5,351
29.758621
88
py
RegularizedBN
RegularizedBN-main/tests/test_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 io import tempfile import unittest import torch from fairseq.data import Dictionary class TestDictionary(unittest.TestCase): d...
3,336
27.521368
80
py
RegularizedBN
RegularizedBN-main/tests/test_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 unittest import torch from fairseq import utils class TestUtils(unittest.TestCase): def test_convert_padding_direction(self): ...
3,067
28.219048
78
py
RegularizedBN
RegularizedBN-main/tests/test_character_token_embedder.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 unittest from fairseq.data import Dictionary from fairseq.modules import CharacterTokenEmbedder class TestCharacterToke...
1,656
34.255319
96
py
RegularizedBN
RegularizedBN-main/tests/gpu/__init__.py
0
0
0
py
RegularizedBN
RegularizedBN-main/tests/gpu/test_binaries_gpu.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 contextlib import logging import os import tempfile import unittest from io import StringIO import torch from fairseq import options f...
9,920
31.421569
92
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/test_cross_entropy.py
#!/usr/bin/env python3 # 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 examples.speech_recognition.criterions.cross_entropy_acc import CrossEntropyWithAccCriterion from .asr_test_base i...
1,428
39.828571
97
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/test_data_utils.py
#!/usr/bin/env python3 # 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 unittest import torch from examples.speech_recognition.data import data_utils class DataUtilsTest(unittest.Te...
1,039
42.333333
108
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/asr_test_base.py
#!/usr/bin/env python3 import argparse import os import unittest from inspect import currentframe, getframeinfo import numpy as np import torch from fairseq.data import data_utils as fairseq_data_utils from fairseq.data.dictionary import Dictionary from fairseq.models import ( BaseFairseqModel, FairseqDecoder...
19,491
33.9319
92
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/test_vggtransformer.py
#!/usr/bin/env python3 # import models/encoder/decoder to be tested from examples.speech_recognition.models.vggtransformer import ( TransformerDecoder, VGGTransformerEncoder, VGGTransformerModel, vggtransformer_1, vggtransformer_2, vggtransformer_base, ) # import base test class from .asr_test...
4,578
32.669118
87
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/__init__.py
0
0
0
py
RegularizedBN
RegularizedBN-main/tests/speech_recognition/test_collaters.py
#!/usr/bin/env python3 # 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 unittest import numpy as np import torch from examples.speech_recognition.data.collaters import Seq2SeqCollater...
2,048
33.728814
87
py
RegularizedBN
RegularizedBN-main/fairseq/registry.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 argparse REGISTRIES = {} def setup_registry( registry_name: str, base_class=None, default=None, required=False, ): ...
3,554
35.649485
107
py
RegularizedBN
RegularizedBN-main/fairseq/checkpoint_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 collections import logging import os import re import traceback from collections import OrderedDict from typing import Union import to...
20,546
37.84121
114
py
RegularizedBN
RegularizedBN-main/fairseq/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 contextlib import copy import importlib.util import logging import math import os import sys import warnings from collections import de...
19,882
31.864463
111
py
RegularizedBN
RegularizedBN-main/fairseq/hub_utils.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. import argparse import copy import logging import os from typing import List, Dict, Iterator, Tuple, Any import tor...
10,099
36.269373
114
py
RegularizedBN
RegularizedBN-main/fairseq/sequence_scorer.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 sys from fairseq import utils class SequenceScorer(object): """Scores the target for a given source sentence.""" ...
5,071
36.850746
107
py
RegularizedBN
RegularizedBN-main/fairseq/binarizer.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 fairseq.tokenizer import tokenize_line import torch from fairseq.file_io import PathManager d...
3,354
30.952381
84
py
RegularizedBN
RegularizedBN-main/fairseq/distributed_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 logging import os import pickle import random import socket import struct import subprocess import warnings from collections import Ord...
11,970
36.06192
107
py
RegularizedBN
RegularizedBN-main/fairseq/file_io.py
#!/usr/bin/env python3 # 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 shutil from typing import List, Optional try: from fvcore.common.file_io import PathManager as ...
3,287
27.102564
87
py
RegularizedBN
RegularizedBN-main/fairseq/pdb.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 multiprocessing import os import pdb import sys __all__ = ['set_trace'] _stdin = [None] _stdin_lock = multiprocessing.Lock() try: ...
1,089
21.708333
65
py
RegularizedBN
RegularizedBN-main/fairseq/sequence_generator.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 typing import Dict, List, Optional import torch import torch.nn as nn from fairseq import search, utils from fairseq.data im...
39,633
39.31943
118
py
RegularizedBN
RegularizedBN-main/fairseq/legacy_distributed_data_parallel.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. """ A modified version of the legacy DistributedDataParallel module that uses c10d communication primitives. This version is simpler than the ...
6,223
35.397661
88
py
RegularizedBN
RegularizedBN-main/fairseq/options.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 argparse import sys from typing import Callable, List, Optional import torch from fairseq import utils from fairseq.data.indexed_data...
36,241
52.375552
120
py
RegularizedBN
RegularizedBN-main/fairseq/tokenizer.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 re SPACE_NORMALIZER = re.compile(r"\s+") def tokenize_line(line): line = SPACE_NORMALIZER.sub(" ", line) line = line.strip()...
345
22.066667
65
py
RegularizedBN
RegularizedBN-main/fairseq/checkpoint_utils_bn.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. #**************** #for testing bn #**************** import collections import logging import os import re import traceback from collections im...
20,533
37.597744
114
py
RegularizedBN
RegularizedBN-main/fairseq/token_generation_constraints.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. """Implements tracking of constraints for a beam item. A list of constraints is given as a list of one or more token sequences, each of lengt...
16,525
31.986028
108
py
RegularizedBN
RegularizedBN-main/fairseq/file_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. """ Utilities for working with the local dataset cache. This file is adapted from `AllenNLP <https://github.com/allenai/allennlp>`_. and `hugg...
11,036
32.243976
103
py
RegularizedBN
RegularizedBN-main/fairseq/incremental_decoding_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. from typing import Dict, Optional import uuid from torch import Tensor class FairseqIncrementalState(object): def __init__(self, *args...
1,760
33.529412
112
py