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 |
|---|---|---|---|---|---|---|
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
import pdb
from fairseq import metrics, utils
from fairseq.dataclass.utils import gen_parser... | 4,443 | 36.344538 | 79 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 pdb
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqC... | 19,073 | 38.7375 | 95 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,847 | 36.016216 | 114 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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, ... | 7,006 | 38.365169 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions impo... | 4,550 | 35.701613 | 105 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 FairseqCr... | 3,202 | 33.815217 | 79 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.
import math
from argparse import Namespace
import torch
import torch.nn.functi... | 9,767 | 37.456693 | 134 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions impo... | 3,352 | 35.846154 | 82 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,797 | 36.98 | 96 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
import torch
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
def label_s... | 6,346 | 38.42236 | 91 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,614 | 37.140496 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 fairseq import utils
from fairseq.criterions import LegacyFairseqCriterion, register_criterion
from torch import nn
@register_criterion... | 3,793 | 36.564356 | 93 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
f... | 30,462 | 39.401857 | 91 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,200 | 36.626238 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,343 | 24.204301 | 79 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.
from typing import Dict, List, NamedTuple, Optional
import torch
import torch.nn as nn
from torch import Tensor
EncoderOut = NamedTuple(
... | 2,934 | 30.55914 | 78 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 utils
from fairseq.models import (
Fai... | 38,606 | 36.887144 | 165 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
from fairseq import utils
from fairseq.mod... | 43,362 | 41.554465 | 159 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,959 | 34.963964 | 98 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
_GOSSIP_DISABLED = ... | 3,940 | 36.894231 | 82 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 BaseFairs... | 24,032 | 31.653533 | 131 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,509 | 32.298817 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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
from typing import List, Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as... | 33,626 | 31.647573 | 200 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 List
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from... | 7,117 | 34.237624 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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... | 14,715 | 38.880759 | 101 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,860 | 38.485089 | 89 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,091 | 30.825 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,272 | 35.364706 | 89 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 pdb
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.iterative_refinement_generator import DecoderOut... | 16,550 | 36.109865 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,
FairseqEnco... | 23,124 | 37.097199 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/models/speech_to_text/s2t_transformer.py | #!/usr/bin/env python3
import logging
import math
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
FairseqEncoder,
FairseqEncoderDecoderModel,
... | 17,402 | 35.71519 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,845 | 36.483051 | 114 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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... | 19,409 | 35.971429 | 113 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.model_parallel.modules import ModelParallelMultiheadAttent... | 2,315 | 28.692308 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 fairseq.incremental_deco... | 13,354 | 36.832861 | 97 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.
import random
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.model_parall... | 1,777 | 28.633333 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.model_parallel.modules import (
ModelParallelTransforme... | 3,752 | 31.076923 | 95 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 registe... | 7,584 | 43.356725 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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... | 32,034 | 43.369806 | 151 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 options... | 22,695 | 36.763727 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,823 | 36.583333 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 import FairseqDataclass
from fa... | 8,426 | 35.323276 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 dataclasses import dataclass, field
from typing import List
import torch
from fairseq.dataclass import FairseqDataclass
from omegaconf i... | 3,583 | 31.880734 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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.
try:
from fairscale.optim import OSS
_has_fairscale = True
except ImportError:
_has_fairscale = False
def shard_(args, optimiz... | 1,129 | 25.904762 | 85 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,235 | 35.046243 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 fairseq import optim, utils
from .dynamic_loss_scaler impo... | 18,608 | 36.823171 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 dataclasses import dataclass, field
from typing import List
import torch
import torch.distributed as dist
imp... | 8,448 | 36.71875 | 100 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,912 | 39.568773 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,319 | 37.166189 | 104 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,278 | 30.195122 | 92 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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... | 5,094 | 32.741722 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 dataclasses import dataclass, field
from typing import List
from fairseq.dataclass import FairseqDataclass
from omegaconf import II
fro... | 3,114 | 35.22093 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 . import LegacyFairseqLRScheduler, register_lr_scheduler
@register_lr_scheduler("tri_stage")
class TriStageLRSchedule(Lega... | 5,087 | 29.650602 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 LegacyFairseqLRScheduler, register_lr_scheduler
@register_lr_scheduler("reduce_lr_on_plateau"... | 4,791 | 40.310345 | 97 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 dataclasses import dataclass, field
from typing import List
from fairseq.dataclass import FairseqDataclass
from omegaconf im... | 4,989 | 33.178082 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 BaseScorer, register_scorer
from fairseq.scoring.tokenizer impo... | 5,087 | 31.202532 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 LegacyFairseqTas... | 3,678 | 29.658333 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 LegacyFairseqTas... | 3,822 | 28.867188 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 LegacyFairseqTas... | 3,544 | 28.541667 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 pdb
import numpy as np
import torch
from fairseq.data import FairseqDataset, data_utils
logger = logging.getLogger(__n... | 18,866 | 38.972458 | 121 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,988 | 34.43787 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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,117 | 28.013699 | 101 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/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 __in... | 2,153 | 26.265823 | 70 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/raw_label_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 torch
from . import FairseqDataset
class RawLabelDataset(FairseqDataset):
def __init__(self, labels):
super().__init__()... | 546 | 21.791667 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/resampling_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import numpy as np
from fairseq.data import BaseWrapperDataset, plasma_utils
logger = logging.getLogger(__name__)
class Re... | 4,316 | 29.835714 | 78 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/dictionary.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import pdb
import os
from collections import Counter
from multiprocessing import Pool
import torch
from fairseq import utils
from fairseq.bina... | 12,619 | 31.525773 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/append_token_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 AppendTokenDataset(BaseWrapperDataset):
def __init__(self, datas... | 1,065 | 24.380952 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/fasta_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 os
import subprocess
import threading
from pathlib import Path
import numpy as np
import torch
def fasta_file_path(prefix_path):
... | 3,387 | 30.37037 | 107 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/mask_tokens_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 functools import lru_cache
import numpy as np
import torch
from fairseq.data import Dictionary, data_utils
from . import BaseWrapperDat... | 6,995 | 38.083799 | 87 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/concat_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import bisect
import numpy as np
from torch.utils.data.dataloader import default_collate
from . import FairseqDataset
class ConcatDataset(... | 4,645 | 36.168 | 86 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/data_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.
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import contextlib
import itertools
impo... | 18,197 | 35.396 | 120 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/nested_dictionary_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 collections import OrderedDict
import torch
from torch.utils.data.dataloader import default_collate
from . import FairseqDataset
def ... | 4,029 | 30.984127 | 86 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/add_target_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 torch
from . import BaseWrapperDataset, data_utils
class AddTargetDataset(BaseWrapperDataset):
def __init__(
self,
... | 2,183 | 29.760563 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/transform_eos_lang_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.
from typing import Optional
import torch
from . import FairseqDataset
class TransformEosLangPairDataset(FairseqDataset):
"""A :class:... | 3,732 | 33.247706 | 98 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/lm_context_window_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.monolingual_dataset import MonolingualDataset
from . import FairseqDataset
class LMContex... | 2,942 | 35.7875 | 90 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/colorize_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 torch
from . import BaseWrapperDataset
class ColorizeDataset(BaseWrapperDataset):
""" Adds 'colors' property to net input that i... | 845 | 31.538462 | 113 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/iterators.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import logging
import math
import operator
import os
import queue
import time
from threading import Thread
import pdb
import ... | 20,567 | 33.626263 | 94 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/backtranslation_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq import utils
from . import FairseqDataset
def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True):... | 6,247 | 36.638554 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/monolingual_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 FairseqDataset, data_utils
def collate(samples, pad_idx, eos_idx):
if len(samples) == 0:
... | 7,951 | 33.424242 | 110 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/roll_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 torch
from . import BaseWrapperDataset
class RollDataset(BaseWrapperDataset):
def __init__(self, dataset, shifts):
super... | 485 | 24.578947 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/replace_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 . import BaseWrapperDataset
class ReplaceDataset(BaseWrapperDataset):
"""Replaces tokens found in the dataset by a specified replac... | 1,370 | 36.054054 | 113 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/id_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 torch
from . import FairseqDataset
class IdDataset(FairseqDataset):
def __getitem__(self, index):
return index
def ... | 423 | 20.2 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/indexed_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 os
import shutil
import struct
from functools import lru_cache
import numpy as np
import torch
from fairseq.data.fasta_dataset import ... | 17,195 | 29.597865 | 84 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/denoising_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 math
import numpy as np
import torch
from . import FairseqDataset, data_utils
def collate(
samples,
pad_idx,
eos_idx,
... | 15,627 | 34.762014 | 88 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/prepend_token_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 PrependTokenDataset(BaseWrapperDataset):
def __init__(self, data... | 1,066 | 24.404762 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/numel_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 NumelDataset(BaseWrapperDataset):
def __init__(self, dataset, re... | 786 | 23.59375 | 65 | py |
DDRS-NAT | DDRS-NAT-master/build/lib.linux-x86_64-3.8/fairseq/data/noising.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from fairseq.data import data_utils
class WordNoising(object):
"""Generate a noisy version of a sentence... | 12,383 | 36.077844 | 88 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.