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
ELLE
ELLE-main/fairseq_ELLE/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
ELLE
ELLE-main/fairseq_ELLE/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...
4,554
28.198718
88
py
ELLE
ELLE-main/fairseq_ELLE/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 tempfile import unittest import torch from fairseq.data import Dictionary class TestDictionary(unittest.TestCase): def test_fi...
1,863
25.253521
80
py
ELLE
ELLE-main/fairseq_ELLE/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): ...
2,131
24.380952
65
py
ELLE
ELLE-main/fairseq_ELLE/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
ELLE
ELLE-main/fairseq_ELLE/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,247
33.80651
87
py
ELLE
ELLE-main/fairseq_ELLE/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
ELLE
ELLE-main/fairseq_ELLE/fairseq/FPI.py
""" preprocessing script before training distillBert specific to bert->distillbert """ import collections import sys import torch.nn as nn import torch import math import numpy as np import random from . import checkpoint_utils def wider3d(w,dim,new_width,choices,div=False): old_width = w.size(dim) if dim==0: new_...
12,372
32.082888
245
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/FPI_gpt.py
""" preprocessing script before training distillBert specific to bert->distillbert """ import collections import sys import torch.nn as nn import torch import math import numpy as np import random from . import checkpoint_utils def wider3d(w,dim,new_width,choices,div=False, add_noise=False): old_width = w.size(dim...
15,279
35.908213
287
py
ELLE
ELLE-main/fairseq_ELLE/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 shutil import traceback from collections import OrderedDict from typing import Un...
18,166
36.151329
124
py
ELLE
ELLE-main/fairseq_ELLE/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. from collections import defaultdict import contextlib import copy import importlib.util import math import os import sys from typing import Ca...
13,882
31.665882
111
py
ELLE
ELLE-main/fairseq_ELLE/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 os import torch from torch import nn from fairseq import utils from fairseq.dat...
8,171
33.627119
117
py
ELLE
ELLE-main/fairseq_ELLE/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.""" ...
4,508
36.575
107
py
ELLE
ELLE-main/fairseq_ELLE/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 os import pickle import socket import subprocess import warnings import torch import torch.distributed as dist from fairseq import ut...
6,952
35.984043
97
py
ELLE
ELLE-main/fairseq_ELLE/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 import torch from fairseq import search, utils from fairseq.data import data_utils from fairseq.models import FairseqIncremental...
30,353
41.512605
118
py
ELLE
ELLE-main/fairseq_ELLE/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,724
36.154696
88
py
ELLE
ELLE-main/fairseq_ELLE/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 torch import sys from fairseq import utils from fairseq.data.indexed_dataset import get_available_dataset_impl def ...
31,643
53
120
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/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 torch try: from fairseq import libbleu except ImportError as e: import sys sys.stderr.write('ERR...
3,955
29.430769
83
py
ELLE
ELLE-main/fairseq_ELLE/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...
10,466
31.811912
98
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/search.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 torch class Search(object): def __init__(self, tgt_dict): self.pad = tgt_dict.pad() self.unk = tgt_...
11,223
36.918919
104
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/iterative_refinement_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. from collections import namedtuple import torch from fairseq import utils DecoderOut = namedtuple('IterativeRefinementDecoderOut', [ '...
9,288
36.007968
117
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/trainer.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. """ Train a network across multiple GPUs. """ import contextlib import math import os import sys from collections import OrderedDict from ite...
30,786
37.872475
197
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/FPI_new.py
""" preprocessing script before training distillBert specific to bert->distillbert """ import collections import sys import torch.nn as nn import torch import math import numpy as np import random from . import checkpoint_utils def wider3d(w,dim,new_width,choices,div=False, add_noise=False): old_width = w.size(dim...
15,991
36.451991
287
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/transformer_sentence_encoder_layer.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 import utils from fairseq.modules import ( LayerNorm, ...
2,916
30.365591
80
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/learned_positional_embedding.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 from fairseq import utils class LearnedPositionalEmbedding(nn.Embedding): """ This module learns positional e...
1,881
35.901961
94
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/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 math import torch from .multihead_attention import MultiheadAttention class SparseMultiheadAttention(MultiheadAttention): """ Spa...
4,525
42.104762
100
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/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 math import torch from torch import nn from torch.nn import Parameter import torch.nn.functional as F from fairseq import utils clas...
15,711
42.283747
116
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/highway.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 torch import nn class Highway(torch.nn.Module): """ A `Highway layer <https://arxiv.org/abs/1505.00387>`_. Ad...
1,745
31.943396
97
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/linearized_convolution.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.functional as F from fairseq import utils from .conv_tbc import ConvTBC class LinearizedConvolution(ConvTBC):...
3,598
39.897727
95
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/downsampled_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 math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.modules.scalar_bias import scalar_bias class ...
9,815
37.194553
106
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/gelu.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. """ See "Gaussian Error Linear Units (GELUs)" by Dan Hendrycks and Kevin Gimpel with the corresponding GitHub repo: https://github.com/hendryck...
790
29.423077
90
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/positional_embedding.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 from .learned_positional_embedding import LearnedPositionalEmbedding from .sinusoidal_positional_embedding import Sinus...
1,287
36.882353
83
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/adaptive_input.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 torch import nn from typing import List class AdaptiveInput(nn.Module): def __init__( self, vocab_s...
2,283
30.287671
80
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/vggblock.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 __future__ import absolute_import, division, print_function, unicode_literals from collections.abc import Iterable from itertools import...
4,057
33.683761
88
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/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 torch.nn.functional as F from torch import nn from typing import List, Tuple from .highway import Highway from fairseq....
5,298
32.327044
106
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/unfold.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.functional as F def unfold1d(x, kernel_size, padding_l, pad_value=0): '''unfold T x B x C to T x B x C x K''' if ker...
570
30.722222
91
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/adaptive_softmax.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 operator import functools import torch import torch.nn.functional as F from torch import nn class TiedLinear(nn.Module): def __i...
7,207
33.821256
112
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/conv_tbc.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 torch.nn.modules.utils import _single class ConvTBC(torch.nn.Module): """1D convolution over an input of shape (time x...
1,356
35.675676
90
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/transformer_layer.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 import utils from fairseq.modules import LayerNorm, MultiheadA...
13,496
42.259615
147
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/mean_pool_gating_network.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.functional as F class MeanPoolGatingNetwork(torch.nn.Module): """A simple mean-pooling gating network for s...
2,007
38.372549
84
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/logsumexp_moe.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 LogSumExpMoE(torch.autograd.Function): """Standard LogSumExp forward pass, but use *posterior* for the backward. ...
835
29.962963
78
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/beamable_mm.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 class BeamableMM(nn.Module): """This module provides an optimized MM for beam decoding with attention...
1,779
36.083333
80
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/layer_norm.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 LayerNorm(normalized_shape, eps=1e-5, elementwise_affine=True, export=False): if not export and torch.cuda.is_available...
590
33.764706
81
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/scalar_bias.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 ScalarBias(torch.autograd.Function): """ Adds a vector of scalars, used in self-attention mechanism to allow ...
888
26.78125
74
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/transformer_sentence_encoder.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 Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from fairseq.modules import ( Layer...
8,950
34.804
106
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/grad_multiply.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 GradMultiply(torch.autograd.Function): @staticmethod def forward(ctx, x, scale): ctx.scale = scale ...
442
22.315789
65
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/sparse_transformer_sentence_encoder.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 from fairseq.modules import TransformerSentenceEncoder from fairseq.modules.sparse_transformer_sentence_encoder_layer im...
3,164
36.678571
107
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/sinusoidal_positional_embedding.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 torch import torch.nn as nn import torch.onnx.operators from fairseq import utils class SinusoidalPositionalEmbedding(n...
3,539
40.162791
116
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/lightweight_convolution.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 import utils from fairseq.modules.unfold import unfold1d de...
10,290
39.356863
103
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/dynamic_convolution.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 import utils from .unfold import unfold1d def DynamicConv(i...
10,910
43.901235
132
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/dynamicconv_layer/setup.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 setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension setup( name='dyna...
613
24.583333
67
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/dynamicconv_layer/dynamicconv_layer.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 torch import nn from torch.autograd import Function import torch.nn.functional as F import dynamicconv_cuda from fairseq im...
8,605
39.403756
129
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/lightconv_layer/setup.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 setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension setup( name='ligh...
545
25
67
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/modules/lightconv_layer/lightconv_layer.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 torch import nn from torch.autograd import Function import torch.nn.functional as F import lightconv_cuda from fairseq impo...
4,235
34.3
98
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/fairseq_criterion.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.nn.modules.loss import _Loss class FairseqCriterion(_Loss): def __init__(self, args, task): super().__init__() ...
1,359
29.222222
103
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/nat_loss.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 torch.nn.functional as F from fairseq import utils import torch from torch import Tensor from . import FairseqCriterion, ...
6,035
34.298246
88
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/continual_cross_entropy.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 torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @register_criteri...
2,685
38.5
109
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/legacy_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 math import torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion def ...
6,360
41.97973
100
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/adaptive_loss.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 torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @register_criteri...
3,600
37.72043
105
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/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 math import torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @re...
2,837
33.609756
130
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/continual_KI.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 torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @re...
6,437
38.018182
143
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/cross_entropy.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 torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @register_criteri...
2,607
37.352941
95
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/clmb_criterion.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 torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @re...
2,844
33.695122
130
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/sentence_prediction.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 torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @re...
3,341
33.453608
97
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/sentence_ranking.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 torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @re...
3,874
34.227273
87
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/composite_loss.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 import nn from fairseq import utils from . import FairseqCriterion, register_criterion @register_criterion('composite_loss') cla...
3,386
35.815217
96
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/criterions/binary_cross_entropy.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 torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion @reg...
2,468
33.291667
82
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/levenshtein_transformer.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.iterative_refinement_generator import DecoderOut from fairseq...
27,687
36.670748
120
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/wav2vec.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 math import torch import torch.nn as nn import torch.nn.functional as F from . import ( BaseFairseqModel, register_mo...
18,421
37.864979
119
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/lstm.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 import options, utils from fairseq.models import ( Fairse...
24,690
42.700885
105
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/nonautoregressive_ensembles.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 torch import torch.nn.functional as F from fairseq.models.levenshtein_transformer import ( _fill, _skip, _ski...
9,040
37.969828
120
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/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 torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.models import ( BaseFairseqMode...
15,476
42.231844
100
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/model_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 List, Optional import torch from torch import Tensor @torch.jit.script def script_skip_tensor_list(x: List[Tensor], mask...
2,335
24.67033
103
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/insertion_transformer.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 torch.nn.functional as F from fairseq.models import register_model, register_model_architecture from f...
10,516
36.560714
88
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/fairseq_encoder.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 class FairseqEncoder(nn.Module): """Base class for encoders.""" def __init__(self, dictionary): super...
1,396
29.369565
78
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/fconv.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 torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.models import ( Fai...
27,654
40.399701
127
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/lightconv.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 torch import torch.nn as nn import torch.nn.functional as F from fairseq import options, utils from fairseq.models import...
34,158
44.00527
125
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/nonautoregressive_transformer.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.functional as F from fairseq import utils from fairseq.iterative_refinement_generator import DecoderOut from fai...
15,538
35.997619
108
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/transformer.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 namedtuple import math import torch import torch.nn as nn import torch.nn.functional as F from fairseq import option...
39,647
43.498316
159
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/fconv_self_att.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 os import torch import torch.nn as nn import torch.nn.functional as F from fairseq import checkpoint_utils from fairseq.m...
24,122
40.591379
111
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/fairseq_decoder.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 from fairseq import utils class FairseqDecoder(nn.Module): """Base class for decoders.""" def __init__(self,...
2,829
33.512195
95
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/fairseq_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. """ Base classes for various fairseq models. """ from typing import Dict, List, Optional import torch import torch.nn as nn import torch.nn.f...
16,053
34.995516
110
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/iterative_nonautoregressive_transformer.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.models import register_model, register_model_architecture from fairseq.models.nonautoregressive_transformer import ...
8,248
40.039801
99
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/distributed_fairseq_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 inspect import torch.nn as nn from fairseq.legacy_distributed_data_parallel import LegacyDistributedDataParallel from fairseq.models ...
2,426
35.223881
82
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/bart/hub_interface.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 copy import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from typing import List from fairseq impor...
6,872
36.763736
129
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/bart/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. """ BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension """ import torch.nn as n...
10,444
41.287449
121
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/roberta/hub_interface.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 torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.data import enco...
8,410
40.029268
114
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/roberta/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. """ RoBERTa: A Robustly Optimized BERT Pretraining Approach. """ import torch import torch.nn as nn import torch.nn.functional as F from fair...
22,285
43.483034
142
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/models/roberta/alignment_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 collections import Counter from typing import List import torch def align_bpe_to_words(roberta, bpe_tokens: torch.LongTensor, other_to...
4,074
34.12931
98
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/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 torch import torch.distributed as dist from . import FairseqOptimizer class FairseqBMUF(FairseqOptimizer): """ Implements in...
8,016
34.631111
90
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/nag.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 torch.optim.optimizer import Optimizer, required from . import FairseqOptimizer, register_optimizer @register_optimizer('...
3,210
32.103093
96
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/sgd.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 from . import FairseqOptimizer, register_optimizer @register_optimizer('sgd') class SGD(FairseqOptimizer): def __ini...
1,359
33
92
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/adamax.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.optim from . import FairseqOptimizer, register_optimizer @register_optimizer('adamax') class FairseqAdamax(Fairse...
5,819
37.289474
92
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/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. from itertools import chain import torch from fairseq import optim, utils class DynamicLossScaler(object): def __init__( self...
14,764
36.379747
97
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/adam.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 types import torch import torch.optim import torch.distributed as dist from . import FairseqOptimizer, register_optimizer...
13,968
41.458967
139
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/adafactor.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 torch import torch.optim from . import FairseqOptimizer, register_optimizer @register_optimizer('adafactor') class Fairs...
9,545
43.607477
110
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/adagrad.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 from . import FairseqOptimizer, register_optimizer @register_optimizer('adagrad') class Adagrad(FairseqOptimizer): d...
1,195
31.324324
92
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/fairseq_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 math import torch class FairseqOptimizer(object): def __init__(self, args): super().__init__() self.args = args...
3,751
31.912281
99
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/adadelta.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 from . import FairseqOptimizer, register_optimizer @register_optimizer('adadelta') class Adadelta(FairseqOptimizer): ...
1,752
38.840909
105
py
ELLE
ELLE-main/fairseq_ELLE/fairseq/optim/lr_scheduler/inverse_square_root_schedule.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 FairseqLRScheduler, register_lr_scheduler @register_lr_scheduler('inverse_sqrt') class InverseSquareRootSchedule(FairseqLRSche...
3,027
39.373333
97
py