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
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_anchornorm.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : MaskBatchNorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.nn.parameter import Parameter import numpy as np from scipy import io __all__ = ['MaskAnchorNorm'] de...
2,951
32.168539
103
py
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_groupnorm.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : groupnorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F def tile(a, repeats, dim): """ Substitute for numpy's repeat function. Taken from https://discuss.pytorch.org...
7,391
43
131
py
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_layernorm3d.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : MaskBatchNorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules._functions import SyncBatchNorm as sync_batch_norm ...
2,211
32.515152
83
py
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_groupscale.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : MaskPowerNorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F __all__ = ['MaskGruopScale'] def _sum_ft(tensor): """sum over the first and last dimention""" return ten...
6,418
34.076503
119
py
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_identity.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : MaskBatchNorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F __all__ = ['MaskIdentity'] class MaskIdentityNorm(nn.Module): """ """ def __init__(self, num_featur...
790
23.71875
62
py
RegularizedBN
RegularizedBN-main/fairseq/modules/norm/mask_batchnorm3d.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : MaskBatchNorm.py # Distributed under MIT License. import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules._functions import SyncBatchNorm as sync_batch_norm ...
16,604
41.686375
141
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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,719
39.184332
129
py
RegularizedBN
RegularizedBN-main/fairseq/modules/fc/oni_fc.py
""" Orthogonalization by Newton’s Iteration """ import torch.nn import torch.nn.functional as F from torch.nn import Parameter from torch.autograd import Variable from typing import List from torch.autograd.function import once_differentiable __all__ = ['WN_Conv2d', 'OWN_Conv2d', 'ONI_Conv2d','ONI_ConvTranspose2d', ...
12,549
41.398649
146
py
RegularizedBN
RegularizedBN-main/fairseq/modules/fc/dropout_fc.py
import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['DropoutFC'] class DropoutFC(nn.Linear): def __init__(self, in_features, out_features, bias=True, dropout=0, scale=1.0): super(DropoutFC, self).__init__(in_features, out_features, bias) print('DropoutFC dropout:{}, sc...
940
28.40625
83
py
RegularizedBN
RegularizedBN-main/fairseq/modules/fc/conv.py
import torch from torch import nn import torch.nn.functional as F class Conv1d(nn.Conv1d): def __init__(self,in_channels, out_channels, kernel_size=3, stride=1): self.padding = (kernel_size-1)//2 self.stride = stride super(Conv1d, self).__init__(in_channels, out_channels, kernel_size, stride=stride,padding=self....
674
38.705882
112
py
RegularizedBN
RegularizedBN-main/fairseq/modules/fc/wn.py
import torch.nn import torch.nn.functional as F from torch.nn import Parameter from torch.autograd import Variable from typing import List from torch.autograd.function import once_differentiable __all__ = ['CWN'] # norm funcitons-------------------------------- class CWNorm(torch.nn.Module): def forward(self, ...
3,164
38.5625
110
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/pq/em.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 random import logging from collections import Counter import torch class EM: """ EM algorithm used to quantize the...
7,333
33.59434
92
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/pq/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 re from operator import attrgetter, itemgetter import numpy as np import torch.nn as nn import torch.distributed as dis...
11,605
33.541667
110
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/pq/modules/qlinear.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 class PQLinear(nn.Module): """ Quantized counterpart of nn.Linear...
2,547
34.388889
86
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/pq/modules/qconv.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 torch.nn.modules.utils import _pair class PQConv2...
4,245
35.603448
87
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/pq/modules/qemb.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 class PQEmbedding(nn.Module): """ Quantized counterpart of nn.Emb...
3,515
38.954545
103
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/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 from operator import attrgetter import torch.nn as nn import torch.distributed as dist from ..pq.utils import get_layers, att...
2,323
33.176471
107
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/ops.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 emulate_int(w, bits, method, scale=None, zero_point=None): q = globals()[f"emulate_int{bits}_{method}"] return q(w,...
1,669
33.791667
90
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/modules/qlinear.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 ..ops import emulate_int class IntLinear(nn.Module): """ Qu...
3,596
31.405405
101
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/modules/qconv.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.nn.modules.conv import _ConvNd from torch.nn.modules.utils import _pair from ..ops im...
4,415
29.040816
95
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/modules/qemb.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 ..ops import emulate_int class IntEmbedding(nn.Module): """ ...
4,771
34.879699
103
py
RegularizedBN
RegularizedBN-main/fairseq/modules/quantization/scalar/modules/qact.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 ..ops import emulate_int class ActivationQuantizer: """ Fake scalar quantization of the activations using a forwa...
3,033
36.45679
87
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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,679
35
104
py
RegularizedBN
RegularizedBN-main/fairseq/logging/progress_bar.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. """ Wrapper around various loggers and progress bars (e.g., tqdm). """ import atexit import json import logging import os import sys from col...
11,082
29.786111
89
py
RegularizedBN
RegularizedBN-main/fairseq/logging/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. """ A standalone module for aggregating metrics. Metrics can be logged from anywhere using the `log_*` functions defined in this module. The l...
9,325
30.938356
81
py
RegularizedBN
RegularizedBN-main/fairseq/logging/meters.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 from collections import OrderedDict import time from typing import Dict, Optional try: import torch def type_as(a, b):...
7,885
26.477352
79
py
RegularizedBN
RegularizedBN-main/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. import inspect from typing import Any, Dict, List from torch.nn.modules.loss import _Loss from fairseq import metrics, utils class Fairseq...
4,258
34.491667
79
py
RegularizedBN
RegularizedBN-main/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 import torch from torch import Tensor from fairseq import metrics, utils from fairseq.criterions...
6,238
34.856322
98
py
RegularizedBN
RegularizedBN-main/fairseq/criterions/wav2vec_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 metrics, utils from fairseq.criterions import FairseqCriterion,...
6,437
39.490566
126
py
RegularizedBN
RegularizedBN-main/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 metrics, utils from fairseq.criterions import FairseqCriterion,...
6,769
43.248366
136
py
RegularizedBN
RegularizedBN-main/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 metrics, utils from fairseq.criterions import FairseqCriterion, register_cri...
3,981
38.039216
105
py
RegularizedBN
RegularizedBN-main/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 metrics, modules, utils from fairseq.criterions import FairseqC...
3,159
34.505618
94
py
RegularizedBN
RegularizedBN-main/fairseq/criterions/ctc.py
# All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. from argparse import Namespace import math import torch import torch.nn.functi...
9,640
37.875
134
py
RegularizedBN
RegularizedBN-main/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 metrics, utils from fairseq.criterions import FairseqCriterion, register_cri...
2,871
37.810811
99
py
RegularizedBN
RegularizedBN-main/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 metrics, utils from fairseq.criterions import FairseqCriterion,...
3,717
37.729167
96
py
RegularizedBN
RegularizedBN-main/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 metrics, utils from fairseq.criterions import FairseqCriterion,...
4,532
37.74359
94
py
RegularizedBN
RegularizedBN-main/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 fairseq.criterions import FairseqCriterion, register_criterion @register_criterion('com...
3,689
35.9
96
py
RegularizedBN
RegularizedBN-main/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...
29,637
42.457478
103
py
RegularizedBN
RegularizedBN-main/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 logging import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.models import ( ...
15,107
41.798867
100
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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 import torch.nn as nn from typing import Dict, List, NamedTuple, Optional from torch import Tensor EncoderOut = NamedTuple( ...
2,955
31.130435
78
py
RegularizedBN
RegularizedBN-main/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 ( Fa...
27,685
40.138187
127
py
RegularizedBN
RegularizedBN-main/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...
37,289
45.6125
165
py
RegularizedBN
RegularizedBN-main/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. import math from typing import Any, Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from fairs...
54,478
44.589121
159
py
RegularizedBN
RegularizedBN-main/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 logging import math import os import torch import torch.nn as nn import torch.nn.functional as F from fairseq import checkpoint_utils...
24,306
40.198305
111
py
RegularizedBN
RegularizedBN-main/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. from typing import Dict, List, Optional, Tuple import torch.nn as nn from fairseq import utils from torch import Tensor class FairseqDecode...
3,064
32.681319
83
py
RegularizedBN
RegularizedBN-main/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. """ import logging from typing import Dict, List, Optional, Tuple import torch import torch.nn a...
19,311
34.696858
86
py
RegularizedBN
RegularizedBN-main/fairseq/models/fairseq_incremental_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 logging from typing import Dict, Optional from torch import Tensor from fairseq.models import FairseqDecoder from fairseq.incremental...
4,387
37.831858
103
py
RegularizedBN
RegularizedBN-main/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 ...
3,982
36.575472
82
py
RegularizedBN
RegularizedBN-main/fairseq/models/LSUV.py
from __future__ import print_function import numpy as np import torch import torch.nn.init import torch.nn as nn gg = {} gg['hook_position'] = 0 gg['total_fc_conv_layers'] = 0 gg['done_counter'] = -1 gg['hook'] = None gg['act_dict'] = {} gg['counter_to_apply_correction'] = 0 gg['correction_needed'] = False gg['current...
5,573
34.730769
145
py
RegularizedBN
RegularizedBN-main/fairseq/models/wav2vec/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 logging import math import sys import torch import torch.nn as nn import torch.nn.functional as F from fairseq.models import BaseFair...
24,032
31.653533
131
py
RegularizedBN
RegularizedBN-main/fairseq/models/wav2vec/wav2vec2_asr.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 math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from fairseq...
22,473
32.344214
113
py
RegularizedBN
RegularizedBN-main/fairseq/models/wav2vec/wav2vec2.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 math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from typing import List, Tu...
33,259
31.575906
200
py
RegularizedBN
RegularizedBN-main/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 logging import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from typing import List fr...
6,947
36.15508
129
py
RegularizedBN
RegularizedBN-main/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 logging impo...
13,648
41.126543
111
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/levenshtein_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.utils import new_arange # -------------- Helper Functions --------------------------------------------------- # d...
9,372
31.887719
103
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/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...
19,562
39.841336
120
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/fairseq_nat_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 math import torch from fairseq.models.transformer import TransformerModel, TransformerEncoder, TransformerDecoder from fairseq.modules...
4,959
32.972603
95
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/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.nat import ( _fill, _skip, _skip_encoder_out, _...
9,020
37.883621
120
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/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,448
36.185053
88
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/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...
16,114
36.917647
108
py
RegularizedBN
RegularizedBN-main/fairseq/models/nat/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.nat import NATransformerModel def _...
8,427
39.912621
99
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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 logging import torch import torch.nn as nn import torch.nn.functional...
17,539
42.9599
122
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/fairseq/models/huggingface/hf_gpt2.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 sys from typing import Dict, List, Optional import torch from fairseq.models import ( FairseqIncrementalD...
7,034
34.175
86
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/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.functional as F from fairseq import utils from fairseq.modules import ( TransformerSentenceEncoderLayer ) fr...
2,356
28.4625
84
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/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. from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from fairseq import utils from torch import Tensor, nn ...
12,558
39.124601
98
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/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...
1,884
28
77
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/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. import logging import torch.nn as nn import torch.nn.functional as F from fairseq.models import ( register_model, ) from fairseq.models...
3,642
31.238938
107
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/models/transformer_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.nn as nn from fairseq.models import register_model, register_model_architecture from fairseq.models.transformer_lm import ( ...
3,752
41.168539
116
py
RegularizedBN
RegularizedBN-main/fairseq/model_parallel/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 logging import torch import torch.nn as nn import torch.nn.functional...
10,367
37.542751
122
py
RegularizedBN
RegularizedBN-main/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,282
34.857143
90
py
RegularizedBN
RegularizedBN-main/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,485
32.519231
92
py
RegularizedBN
RegularizedBN-main/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,430
31.522727
92
py
RegularizedBN
RegularizedBN-main/fairseq/optim/radam.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import math import types import t...
5,993
38.695364
188
py
RegularizedBN
RegularizedBN-main/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...
6,084
37.27044
93
py
RegularizedBN
RegularizedBN-main/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 from .dynamic_loss_scaler import DynamicLossScaler class _FP16O...
15,719
36.163121
103
py
RegularizedBN
RegularizedBN-main/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 logging import math import types import torch import torch.optim import torch.distributed as dist from fairseq.optim import FairseqOp...
8,497
39.084906
116
py
RegularizedBN
RegularizedBN-main/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...
10,509
43.159664
105
py
RegularizedBN
RegularizedBN-main/fairseq/optim/fused_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 types import torch def get_fused_adam_class(): """ Look for the FusedAdam optimizer from apex. We first try to load the ...
13,372
41.72524
109
py
RegularizedBN
RegularizedBN-main/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,266
29.902439
92
py
RegularizedBN
RegularizedBN-main/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 torch from fairseq import utils class FairseqOptimizer(object): def __init__(self, args): super().__init__() se...
4,361
31.552239
87
py
RegularizedBN
RegularizedBN-main/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,823
37
105
py
RegularizedBN
RegularizedBN-main/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...
2,952
38.905405
97
py
RegularizedBN
RegularizedBN-main/fairseq/optim/lr_scheduler/tri_stage_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. from . import FairseqLRScheduler, register_lr_scheduler import math @register_lr_scheduler('tri_stage') class TriStageLRSchedule(FairseqLRSc...
5,062
29.871951
87
py
RegularizedBN
RegularizedBN-main/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 FairseqLRScheduler, register_lr_scheduler @register_lr_scheduler('reduce_lr_on_plateau') clas...
4,743
40.982301
97
py
RegularizedBN
RegularizedBN-main/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(FairseqLRSchedul...
4,758
38.991597
105
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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 FairseqTask, re...
3,605
28.801653
84
py
RegularizedBN
RegularizedBN-main/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 FairseqTask, re...
3,840
29.007813
84
py
RegularizedBN
RegularizedBN-main/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 FairseqTask, re...
3,532
28.689076
84
py
RegularizedBN
RegularizedBN-main/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__) ...
19,691
41.715835
107
py
RegularizedBN
RegularizedBN-main/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,961
34.700599
96
py
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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
RegularizedBN
RegularizedBN-main/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...
1,808
24.842857
70
py