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 |
|---|---|---|---|---|---|---|
rej-summ | rej-summ-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 (
Fai... | 28,661 | 36.862616 | 95 | py |
rej-summ | rej-summ-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
from typing import Any, Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fair... | 42,519 | 36.964286 | 165 | py |
rej-summ | rej-summ-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
... | 25,347 | 36.552593 | 98 | py |
rej-summ | rej-summ-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,750 | 34.72381 | 83 | py |
rej-summ | rej-summ-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 argparse import Namespace
from typing import Dict, List, Optional, Tuple
... | 20,507 | 34.666087 | 98 | py |
rej-summ | rej-summ-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 fairseq.incremental_decoding_utils import with_incremental_state
from fairseq.models im... | 4,468 | 36.554622 | 89 | py |
rej-summ | rej-summ-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 dataclasses import dataclass, field
from typing import Optional
from omegaconf import II
from fairseq import options, utils
from fairs... | 26,790 | 43.064145 | 129 | py |
rej-summ | rej-summ-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 logging
import os
import signal
import threading
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParal... | 5,740 | 37.790541 | 132 | py |
rej-summ | rej-summ-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.
from dataclasses import dataclass, field
import logging
import math
from typing import Optional, Tuple
from omegaconf import II
import sys
im... | 20,928 | 32.167987 | 179 | py |
rej-summ | rej-summ-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 logging
import math
import re
from argparse import Namespace
from dataclasses import dataclass, field
fro... | 27,097 | 34.796565 | 96 | py |
rej-summ | rej-summ-main/fairseq/models/wav2vec/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 math
import torch.nn.functional as F
def pad_to_multiple(x, multiple, dim=-1, value=0):
# Inspired from https://github.com/lucidr... | 680 | 29.954545 | 116 | py |
rej-summ | rej-summ-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 math
from dataclasses import dataclass, field
from typing import List, Tuple
import numpy as np
import torch
import torch.nn as nn
imp... | 43,514 | 32.863813 | 120 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/s2s_conformer.py | # Copyright (c) Facebook, Inc. and its 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 pathlib import Path
import torch
from fairseq import checkpoint_utils
from fairseq.models import register_model, registe... | 6,475 | 36.433526 | 104 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/s2s_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
from pathlib import Path
from typing import Any, Dict, List, Optional
import torch
from torch import Tensor
from fairseq impo... | 26,121 | 35.130014 | 106 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/modules/ctc_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 torch import nn
from fairseq.models import FairseqEncoder
class CTCDecoder(FairseqEncoder):
def __init__(self, dictionary, in_dim)... | 566 | 28.842105 | 65 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/modules/transformer_decoder_aug.py | # Copyright (c) Facebook, Inc. and 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 Any, Dict, List, Optional
from torch import Tensor
from fairseq.models.transformer import Linear
from fairseq.models.tran... | 4,015 | 35.844037 | 84 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/modules/transformer_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.models import FairseqEncoder
from fairseq.modules import LayerNorm, TransformerEncoderLayer
class Transf... | 2,850 | 32.151163 | 86 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_speech/modules/stacked_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
from torch import nn
from fairseq.models.transformer import Linear
class StackedEmbedding(nn.Embedding):
"""Embedding modu... | 1,848 | 36.734694 | 88 | py |
rej-summ | rej-summ-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
from typing import Dict, List
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as ... | 7,869 | 36.122642 | 88 | py |
rej-summ | rej-summ-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
from t... | 15,998 | 39.503797 | 101 | py |
rej-summ | rej-summ-main/fairseq/models/xmod/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.
from fairseq.models.roberta.hub_interface import RobertaHubInterface
import torch
import torch.nn.functional as F
class XMODHubInterface(Ro... | 1,712 | 31.942308 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/xmod/transformer_layer_xmod.py | # Copyright (c) Facebook, Inc. and 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.transformer_layer import TransformerEncoderLayer
from typing import Optional
import torch
import torch.nn as nn
from fair... | 7,081 | 38.344444 | 87 | py |
rej-summ | rej-summ-main/fairseq/models/xmod/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.
from ..roberta.model_xlmr import XLMRModel
from fairseq.models.xmod.transformer_layer_xmod import XMODTransformerEncoderLayerBase
from ..rober... | 22,586 | 29.399731 | 121 | py |
rej-summ | rej-summ-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 --------------------------------------------------- #
... | 9,508 | 31.343537 | 89 | py |
rej-summ | rej-summ-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.... | 20,131 | 38.39726 | 89 | py |
rej-summ | rej-summ-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 (
TransformerDecoder,
TransformerEncoder,
TransformerModel,
)
fro... | 5,555 | 31.115607 | 83 | py |
rej-summ | rej-summ-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 (
_apply_del_words,
_apply_ins_masks,
_ap... | 9,289 | 35.431373 | 89 | py |
rej-summ | rej-summ-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 fa... | 10,460 | 36.227758 | 88 | py |
rej-summ | rej-summ-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 fair... | 16,891 | 35.962801 | 92 | py |
rej-summ | rej-summ-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 _s... | 8,647 | 36.764192 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/hubert/hubert.py | # Copyright (c) Facebook, Inc. and its 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 dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import... | 20,003 | 34.033275 | 101 | py |
rej-summ | rej-summ-main/fairseq/models/hubert/hubert_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 logging
import math
from argparse import Namespace
from dataclasses import dataclass, field
from typing i... | 23,412 | 33.634615 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/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 logging
from argparse import Namespace
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.fu... | 5,014 | 37.875969 | 85 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/berard.py | #!/usr/bin/env python3
from ast import literal_eval
from typing import List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
FairseqEncoder,
FairseqEnc... | 23,149 | 37.075658 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/xm_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 copy
import logging
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from torch im... | 31,002 | 35.218458 | 103 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/utils.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 logging
from collections.a... | 18,584 | 32.010657 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/xm_transformer_unity.py | # Copyright (c) Facebook, Inc. and its 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
from fairseq.models import (
FairseqEncoderModel,
FairseqLanguageModel,
register_model,
register_m... | 11,510 | 35.427215 | 87 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/s2t_conformer.py | # Copyright (c) Facebook, Inc. and its 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
from pathlib import Path
import torch
from fairseq import checkpoint_utils
from fairseq.data.data_utils import le... | 9,032 | 37.438298 | 99 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/convtransformer.py | # Copyright (c) Facebook, Inc. and its 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
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
... | 16,337 | 35.797297 | 101 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/s2t_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 math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from to... | 20,648 | 36.339964 | 87 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/s2t_wav_transformer.py | #!/usr/bin/env python3
import math
import torch
import torch.nn as nn
from fairseq.data.data_utils import compute_mask_indices
from fairseq.models import FairseqEncoder
from fairseq.models.wav2vec import ConvFeatureExtractionModel
from fairseq.modules import GradMultiply, LayerNorm, SamePad, TransformerEncoderLayer
... | 17,665 | 33.982178 | 150 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/modules/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.
from typing import List
import torch
import torch.nn as nn
class Conv1dSubsampler(nn.Module):
"""Convolutional subsampler: a stack of ... | 4,493 | 34.385827 | 89 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/modules/emformer.py | #!/usr/bin/env python3
# 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 mat... | 68,457 | 36.104607 | 97 | py |
rej-summ | rej-summ-main/fairseq/models/speech_to_text/modules/augmented_memory_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 List, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from fairseq.models import FairseqE... | 16,046 | 31.883197 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/ema/ema.py | #!/usr/bin/env python3
"""
This module has the EMA class used to store a copy of the exponentially decayed
model params.
Typical usage of EMA class involves initializing an object using an existing
model (random or from a seed model) and setting the config like ema_decay,
ema_start_update which determine how the EMA ... | 8,135 | 37.742857 | 86 | py |
rej-summ | rej-summ-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 encod... | 8,857 | 36.533898 | 114 | py |
rej-summ | rej-summ-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... | 26,608 | 36.958631 | 117 | py |
rej-summ | rej-summ-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,091 | 33.386555 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/roberta/enc_dec.py | import argparse
import logging
import torch.nn as nn
import fairseq.checkpoint_utils
from fairseq.models import (
FairseqEncoderDecoderModel,
register_model,
register_model_architecture,
)
from fairseq.models.transformer import TransformerDecoder
from fairseq.models.roberta import model as roberta
logger ... | 8,076 | 40.849741 | 168 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/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 logging
import random
from pathlib import Path
from typing import Dict, Optional, Tuple
import torch
import torch.nn as nn
logger = l... | 6,307 | 32.375661 | 101 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/tts_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
from typing import List, Optional
import torch
from torch import nn
from fairseq import utils
from fairseq.data.data_utils im... | 16,971 | 36.301099 | 104 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/codehifigan.py | from argparse import Namespace
import torch
import torch.nn as nn
from fairseq.models.text_to_speech.fastspeech2 import VariancePredictor
from fairseq.models.text_to_speech.hifigan import Generator
class CodeGenerator(Generator):
def __init__(self, cfg):
super().__init__(cfg)
self.dict = nn.Embed... | 3,637 | 36.895833 | 92 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/vocoder.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
from typing import Dict
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from... | 10,684 | 33.918301 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/tacotron2.py | # Copyright (c) Facebook, Inc. and its 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
from torch import nn
from torch.nn import functional as F
from fairseq.models import (
FairseqEncoder,
F... | 15,041 | 38.480315 | 87 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/hifigan.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Conv1d, ConvTranspose1d
from torch.nn.utils import remove_weight_norm, weight_norm
LRELU_SLOPE = 0.1
def init_weights(m, mean=0.0, std=0.01):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
m.wei... | 5,648 | 30.383333 | 76 | py |
rej-summ | rej-summ-main/fairseq/models/text_to_speech/fastspeech2.py | # Copyright (c) Facebook, Inc. and its 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
from torch import nn
from fairseq import utils
from fairseq.data.data_utils import lengths_to_padding_mask
from ... | 15,718 | 34.008909 | 87 | py |
rej-summ | rej-summ-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... | 5,769 | 33.142012 | 86 | py |
rej-summ | rej-summ-main/fairseq/models/transformer/transformer_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 math
from typing import Any, Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import uti... | 17,882 | 36.024845 | 104 | py |
rej-summ | rej-summ-main/fairseq/models/transformer/transformer_decoder_aug.py | # Copyright (c) Facebook, Inc. and 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 Any, Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import utils
from fair... | 14,744 | 36.519084 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/transformer/transformer_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 math
from typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import utils
fr... | 14,290 | 37.520216 | 88 | py |
rej-summ | rej-summ-main/fairseq/models/transformer/transformer_config.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
from dataclasses import dataclass, field, fields
from typing import List, Optional
from omegaconf import II
from fairseq import u... | 13,669 | 38.97076 | 175 | py |
rej-summ | rej-summ-main/fairseq/models/transformer/transformer_base.py | # Copyright (c) Facebook, Inc. and 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
import torch.nn as nn
from torch import Tensor
import logging
from fairseq impo... | 7,111 | 35.659794 | 102 | py |
rej-summ | rej-summ-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 torch import Tensor, nn
from fairseq import utils... | 13,302 | 37.008571 | 97 | py |
rej-summ | rej-summ-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
from fairseq.model_parallel.modules import (
ModelParallelTransformerDecoderLayer,
ModelParalle... | 3,905 | 31.016393 | 95 | py |
rej-summ | rej-summ-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.model_parallel.models.transformer import ModelParallelTransformerDecoder
from fairseq.models import regist... | 7,581 | 43.6 | 88 | py |
rej-summ | rej-summ-main/fairseq/model_parallel/models/pipeline_parallel_transformer/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 logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
from fairseq.model_parallel.model... | 33,889 | 41.898734 | 151 | py |
rej-summ | rej-summ-main/fairseq/model_parallel/models/pipeline_parallel_transformer/layers.py | # Copyright (c) Facebook, Inc. and its 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 collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import option... | 22,687 | 36.750416 | 92 | py |
rej-summ | rej-summ-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... | 8,003 | 34.415929 | 88 | py |
rej-summ | rej-summ-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.
from dataclasses import dataclass, field
import torch
import torch.distributed as dist
from fairseq.dataclass.configs import FairseqBMUFConfi... | 7,449 | 36.064677 | 90 | py |
rej-summ | rej-summ-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.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
import torch
from fairseq.dataclass i... | 3,731 | 32.321429 | 87 | py |
rej-summ | rej-summ-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 LegacyFairseqOptimizer, register_optimizer
@register_optimizer("sgd")
class SGD(LegacyFairseqOptimizer):
... | 1,442 | 31.795455 | 92 | py |
rej-summ | rej-summ-main/fairseq/optim/amp_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 logging
import torch
from fairseq import optim
from omegaconf import DictConfig
logger = logging.getLogger(__name__)
class AMPOptim... | 3,536 | 32.056075 | 97 | py |
rej-summ | rej-summ-main/fairseq/optim/cpu_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 importlib
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
import torch
from fa... | 6,795 | 31.208531 | 86 | py |
rej-summ | rej-summ-main/fairseq/optim/composite.py | # Copyright (c) Facebook, Inc. and its 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 collections import defaultdict
from dataclasses import dataclass, field
from typing import Dict, Any, List, Optional
impo... | 6,757 | 34.382199 | 118 | py |
rej-summ | rej-summ-main/fairseq/optim/shard.py | # Copyright (c) Facebook, Inc. and 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 Any, Dict
from fairseq.distributed import utils
try:
from fairscale.optim import OSS
_has_fairscale = True
exce... | 1,624 | 26.542373 | 85 | py |
rej-summ | rej-summ-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 LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adamax")
class FairseqAdamax(... | 6,225 | 34.988439 | 92 | py |
rej-summ | rej-summ-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 collections import defaultdict
from itertools import chain
import torch
from omegaconf import DictConfig
from fairseq import optim
fro... | 21,467 | 37.750903 | 136 | py |
rej-summ | rej-summ-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
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import Any, List
impor... | 9,184 | 37.270833 | 100 | py |
rej-summ | rej-summ-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 LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adafactor")
clas... | 10,900 | 39.524164 | 92 | py |
rej-summ | rej-summ-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
... | 15,188 | 38.248062 | 104 | py |
rej-summ | rej-summ-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 LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adagrad")
class Adagrad(LegacyFairseqOptim... | 1,279 | 30.219512 | 92 | py |
rej-summ | rej-summ-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
from fairseq.dataclass.utils import gen_parser_from_dataclass
class FairseqOptimizer(object):
def... | 6,176 | 33.316667 | 87 | py |
rej-summ | rej-summ-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 LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adadelta")
class Adadelta(LegacyFairseqOpt... | 1,835 | 37.25 | 105 | py |
rej-summ | rej-summ-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 collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
from fairse... | 3,228 | 36.546512 | 87 | py |
rej-summ | rej-summ-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.
import math
from dataclasses import dataclass, field
from typing import Optional, List, Tuple
from omegaconf import II
from fairseq.dataclass... | 5,766 | 31.767045 | 87 | py |
rej-summ | rej-summ-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.
from dataclasses import dataclass, field
from typing import List
import torch.optim.lr_scheduler
from omegaconf import II
from fairseq.datac... | 5,047 | 34.055556 | 87 | py |
rej-summ | rej-summ-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 collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
... | 5,301 | 34.824324 | 87 | py |
rej-summ | rej-summ-main/fairseq/distributed/fully_sharded_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.
import contextlib
from typing import Optional
import torch
from fairseq.dataclass.configs import DistributedTrainingConfig
from fairseq.distr... | 5,002 | 33.267123 | 80 | py |
rej-summ | rej-summ-main/fairseq/distributed/module_proxy_wrapper.py | # Copyright (c) Facebook, Inc. and 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
class ModuleProxyWrapper(nn.Module):
"""
Wrap a DistributedDataParallel module and forward requests for missing... | 1,965 | 33.491228 | 79 | py |
rej-summ | rej-summ-main/fairseq/distributed/tpu_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.
import torch
from torch import nn
from fairseq.distributed import utils
class TPUDistributedDataParallel(nn.Module):
def __init__(self,... | 1,285 | 28.227273 | 86 | py |
rej-summ | rej-summ-main/fairseq/distributed/utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import io
import logging
import os
import pickle
import random
import socket
import struct
import subprocess
import warnings
from argparse imp... | 29,533 | 35.506799 | 107 | py |
rej-summ | rej-summ-main/fairseq/distributed/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,102 | 35.76506 | 88 | py |
rej-summ | rej-summ-main/fairseq/distributed/distributed_timeout_wrapper.py | # Copyright (c) Facebook, Inc. and its 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 signal
import threading
from torch import nn
logger = logging.getLogger(__name__)
class DistributedTimeou... | 3,092 | 30.561224 | 78 | py |
rej-summ | rej-summ-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
from dataclasses import dataclass, field
import torch
from fairseq.dataclass import FairseqDataclass
fro... | 5,347 | 30.64497 | 88 | py |
rej-summ | rej-summ-main/fairseq/benchmark/benchmark_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 itertools
import random
import torch
from torch.utils import benchmark
from fairseq.modules.multihead_attention import MultiheadAtten... | 4,828 | 26.913295 | 87 | py |
rej-summ | rej-summ-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,
... | 3,090 | 30.865979 | 84 | py |
rej-summ | rej-summ-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 LegacyFairseqTa... | 3,677 | 29.65 | 84 | py |
rej-summ | rej-summ-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
from dataclasses import dataclass, field
from typing import Optional
import torch
from omegaconf import II
from .dummy_datase... | 3,123 | 31.884211 | 84 | py |
rej-summ | rej-summ-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
from dataclasses import dataclass, field
from typing import Optional
import torch
from .dummy_dataset import DummyDataset
from... | 2,757 | 31.833333 | 84 | py |
rej-summ | rej-summ-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 FairseqDataset, data_utils
logger = logging.getLogger(__name__)
d... | 20,545 | 38.895146 | 106 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.