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/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/__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
from fairseq.criterions.fairseq_criterion import FairseqCriterion, LegacyFairseqCrite... | 778 | 30.16 | 89 | 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/label_smoothed_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
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
def label_smoothed_nll_l... | 4,577 | 38.465517 | 95 | 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/multilingual_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 OrderedDict
from fairseq import utils
from fairseq.models import (
FairseqMultiModel,
register_model,
reg... | 8,969 | 44.532995 | 103 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/lstm_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.
from fairseq import options, utils
from fairseq.models import (
FairseqLanguageModel, register_model, register_model_architecture
)
from f... | 6,322 | 47.267176 | 103 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/transformer_align.py | # Copyright (c) Facebook, Inc. and 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.models import register_model, register_model_architecture
from fairseq.models.transformer import (
base_architecture,
tra... | 3,535 | 36.617021 | 117 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/transformer_from_pretrained_xlm.py | # Copyright (c) Facebook, Inc. and 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 typing import Any, Dict
from fairseq import checkpoint_utils
from fairseq.data.legacy.masked_lm_dictionary import MaskedLMDict... | 6,085 | 38.012821 | 88 | 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/lightconv_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.
from fairseq import options
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from... | 10,298 | 57.186441 | 125 | 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/fconv_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.
from fairseq import options
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from... | 4,757 | 44.314286 | 97 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/composite_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 fairseq.models import FairseqEncoder
class CompositeEncoder(FairseqEncoder):
"""
A wrapper around a dictionary of :class:`Fairs... | 1,896 | 32.875 | 98 | 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/__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 argparse
import importlib
import os
from .fairseq_decoder import FairseqDecoder
from .fairseq_encoder import FairseqEncoder
from .fair... | 4,856 | 32.965035 | 113 | py |
RegularizedBN | RegularizedBN-main/fairseq/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.
from fairseq import options, utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,... | 16,604 | 53.442623 | 129 | 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/wav2vec/__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 .wav2vec import * # noqa
from .wav2vec2 import * # noqa
from .wav2vec2_asr import * # noqa
| 277 | 29.888889 | 65 | 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/bart/__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 .hub_interface import * # noqa
from .model import * # noqa
| 244 | 29.625 | 65 | 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/__init__.py | from .fairseq_nat_model import *
from .nonautoregressive_transformer import *
from .nat_crf_transformer import *
from .iterative_nonautoregressive_transformer import *
from .cmlm_transformer import *
from .levenshtein_transformer import *
from .insertion_transformer import *
| 276 | 33.625 | 54 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/nat/cmlm_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.
"""
This file implements:
Ghazvininejad, Marjan, et al.
"Constant-time machine translation with conditional masked language models."
arXiv pre... | 6,347 | 39.954839 | 96 | 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/nat/nat_crf_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 fairseq.models.nat import NATransformerModel, base_architecture
from fairseq.models import register_model, register_model_architecture
f... | 4,252 | 38.37963 | 96 | 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_xlmr.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Unsupervised Cross-lingual Representation Learning at Scale
"""
from fairseq.models import register_model
from .hub_interface import Robe... | 1,204 | 30.710526 | 131 | 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/roberta/__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 .hub_interface import * # noqa
from .model import * # noqa
from .model_camembert import * # noqa
from .model_xlmr import * # noqa
| 317 | 30.8 | 65 | py |
RegularizedBN | RegularizedBN-main/fairseq/models/roberta/model_camembert.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
CamemBERT: a Tasty French Language Model
"""
from fairseq.models import register_model
from .hub_interface import RobertaHubInterface
fro... | 1,888 | 41.931818 | 131 | 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/models/huggingface/__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 models/huggingface/ directory
models_dir = os.path.dirname(__file_... | 709 | 32.809524 | 84 | py |
RegularizedBN | RegularizedBN-main/fairseq/model_parallel/__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 . import criterions, modules, models # noqa
| 228 | 31.714286 | 65 | py |
RegularizedBN | RegularizedBN-main/fairseq/model_parallel/megatron_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.
"""
from fairseq import distributed_utils
from fairseq.trainer import Trainer
try:
from fairse... | 1,959 | 29.625 | 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_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.
from fairseq.modules import (
TransformerEncoderLayer,
TransformerDecoderLayer,
)
from fairseq.model_parallel.modules import ModelPar... | 2,866 | 34.8375 | 81 | py |
RegularizedBN | RegularizedBN-main/fairseq/model_parallel/modules/__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 .multihead_attention import ModelParallelMultiheadAttention
from .transformer_layer import ModelParallelTransformerEncoderLayer, ModelPar... | 765 | 41.555556 | 105 | 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/criterions/vocab_parallel_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
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
try:
from fairseq.mod... | 3,003 | 39.053333 | 99 | py |
RegularizedBN | RegularizedBN-main/fairseq/model_parallel/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
# automatically import any Python files in the criterions/ directory
for file in os.listdir(os.path.dirname(__fil... | 505 | 32.733333 | 78 | 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/__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 models/ directory
models_dir = os.path.dirname(__file__)
for file ... | 668 | 38.352941 | 111 | 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/model_parallel/models/roberta/__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 .model import * # noqa
| 207 | 28.714286 | 65 | 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/__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
from fairseq.optim.fairseq_optimizer import FairseqOptimizer
from fairseq.optim.fp16_... | 962 | 27.323529 | 84 | py |
RegularizedBN | RegularizedBN-main/fairseq/optim/fused_lamb.py | # Copyright (c) Facebook, Inc. and 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.optim import FairseqOptimizer, register_optimizer
@register_optimizer('lamb')
class FairseqLAMB(FairseqOptimizer):
"""LAMB ... | 1,821 | 34.72549 | 92 | 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/dynamic_loss_scaler.py | # Copyright (c) Facebook, Inc. and 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 DynamicLossScaler(object):
def __init__(
self, init_scale=2.**15, scale_factor=2., scale_window=2000,
tolerance=0.0... | 2,539 | 38.6875 | 88 | 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/fairseq_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 FairseqOptimizer
class FairseqLRScheduler(object):
def __init__(self, args, optimizer):
super().__init__()
... | 1,329 | 29.930233 | 81 | py |
RegularizedBN | RegularizedBN-main/fairseq/optim/lr_scheduler/triangular_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('triangular')
class TriangularSchedule(FairseqLR... | 2,711 | 35.16 | 90 | py |
RegularizedBN | RegularizedBN-main/fairseq/optim/lr_scheduler/fixed_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('fixed')
class FixedSchedule(FairseqLRScheduler):
"""Deca... | 2,637 | 37.231884 | 93 | 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/__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
from fairseq.optim.lr_scheduler.fairseq_lr_scheduler import FairseqLRScheduler
buil... | 788 | 31.875 | 91 | py |
RegularizedBN | RegularizedBN-main/fairseq/optim/lr_scheduler/polynomial_decay_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('polynomial_decay')
class PolynomialDecaySchedule(FairseqLRSc... | 2,983 | 41.028169 | 93 | 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/scoring/__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_scoring, register_scoring, SCORING_REGISTRY = registry.setup_registry(
... | 1,073 | 27.263158 | 80 | py |
RegularizedBN | RegularizedBN-main/fairseq/scoring/wer.py | # Copyright (c) Facebook, Inc. and 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.scoring import register_scoring
@register_scoring("wer")
class WerScorer(object):
def __init__(self, *unused):
self... | 844 | 25.40625 | 81 | 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/__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 models/tasks to register them
from . import ( # noqa
dummy_lm,
dummy_masked_lm,
dummy_model,
dummy_mt,
)
| 309 | 22.846154 | 65 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.