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 |
|---|---|---|---|---|---|---|
sign-topic | sign-topic-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... | 9,570 | 40.613043 | 102 | py |
sign-topic | sign-topic-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 utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from f... | 6,423 | 43.923077 | 91 | py |
sign-topic | sign-topic-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 (
TransformerModel,
base... | 3,532 | 36.585106 | 117 | py |
sign-topic | sign-topic-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,076 | 38.718954 | 88 | py |
sign-topic | sign-topic-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.
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,557 | 39.420635 | 91 | py |
sign-topic | sign-topic-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 utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from f... | 11,154 | 35.335505 | 94 | py |
sign-topic | sign-topic-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,244 | 36.641975 | 88 | py |
sign-topic | sign-topic-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,343 | 24.204301 | 79 | py |
sign-topic | sign-topic-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 utils
from fairseq.models import (
FairseqLanguageModel,
register_model,
register_model_architecture,
)
from f... | 5,015 | 35.613139 | 81 | py |
sign-topic | sign-topic-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_encoder import FairseqEncoder
class CompositeEncoder(FairseqEncoder):
"""
A wrapper around a dictionary of :class:`Fai... | 1,928 | 32.258621 | 80 | py |
sign-topic | sign-topic-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.
from typing import Dict, List, NamedTuple, Optional
import torch
import torch.nn as nn
from torch import Tensor
EncoderOut = NamedTuple(
... | 2,930 | 30.516129 | 78 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 utils
from fairseq.models import (
Fai... | 38,655 | 36.898039 | 165 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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.
"""isort:skip_file"""
import argparse
import importlib
import os
from contextlib import ExitStack
from fairseq.dataclass import FairseqDatacl... | 8,206 | 33.923404 | 117 | py |
sign-topic | sign-topic-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 fairseq import options, utils
from fairseq.dataclass import Choice... | 25,286 | 42.977391 | 129 | py |
sign-topic | sign-topic-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,743 | 37.550336 | 132 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 re
from argparse import Namespace
from dataclasses import dataclass, field
from typing import... | 26,049 | 34.782967 | 96 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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... | 41,207 | 33.34 | 120 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-main/fairseq/models/speech_to_speech/modules.py | # Copyright (c) Facebook, Inc. and its 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 import FairseqEncoder
from fairseq.models.transformer import Linear
class CTCDecoder(... | 2,216 | 35.95 | 88 | py |
sign-topic | sign-topic-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... | 25,037 | 34.565341 | 110 | py |
sign-topic | sign-topic-main/fairseq/models/speech_to_speech/__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 .modules import * # noqa
from .s2s_transformer import * # noqa
| 248 | 30.125 | 65 | py |
sign-topic | sign-topic-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,863 | 36.09434 | 88 | py |
sign-topic | sign-topic-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
"""
from typing import Op... | 15,519 | 39.311688 | 101 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-main/fairseq/models/nat/__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.
"""isort:skip_file"""
from .fairseq_nat_model import *
from .nonautoregressive_transformer import *
from .nat_crf_transformer import *
from .i... | 476 | 33.071429 | 65 | py |
sign-topic | sign-topic-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,453 | 38.595092 | 88 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 import register_model, register_model_architecture
from fairseq.models.nat import NATransformerModel, base_architecture
f... | 4,378 | 34.893443 | 88 | py |
sign-topic | sign-topic-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... | 19,187 | 34.337017 | 87 | py |
sign-topic | sign-topic-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
from argparse import Namespace
from typing import Any
import torch
import torch.nn as nn
from dataclasses import dataclass,... | 12,355 | 33.132597 | 88 | py |
sign-topic | sign-topic-main/fairseq/models/hubert/__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 .hubert import * # noqa
from .hubert_asr import * # noqa
| 242 | 29.375 | 65 | py |
sign-topic | sign-topic-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.
from argparse import Namespace
import logging
from typing import Union, Tuple, Optional
import torch
import torch.nn as nn
import torch.nn.fu... | 4,716 | 36.141732 | 83 | py |
sign-topic | sign-topic-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,
FairseqEnco... | 23,124 | 37.097199 | 88 | py |
sign-topic | sign-topic-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... | 24,443 | 34.684672 | 88 | py |
sign-topic | sign-topic-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,585 | 31.953901 | 88 | py |
sign-topic | sign-topic-main/fairseq/models/speech_to_text/s2t_conformer.py | import logging
import torch
from fairseq.models.speech_to_text.s2t_transformer import (
S2TTransformerEncoder,
S2TTransformerModel,
Conv1dSubsampler,
base_architecture as transformer_base_architecture,
)
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.modules.conformer_layer imp... | 6,492 | 39.58125 | 99 | py |
sign-topic | sign-topic-main/fairseq/models/speech_to_text/convtransformer.py | #!/usr/bin/env python3
import logging
import math
from typing import Dict, List, Optional, 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,
... | 16,567 | 35.899777 | 101 | py |
sign-topic | sign-topic-main/fairseq/models/speech_to_text/__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 .berard import * # noqa
from .convtransformer import * # noqa
from .s2t_transformer import * # noqa
from .xm_transformer import * # n... | 361 | 31.909091 | 65 | py |
sign-topic | sign-topic-main/fairseq/models/speech_to_text/s2t_transformer.py | #!/usr/bin/env python3
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
... | 20,008 | 35.579525 | 87 | py |
sign-topic | sign-topic-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,459 | 36.105691 | 97 | py |
sign-topic | sign-topic-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 Tuple, List
import torch
import torch.nn.functional as F
from fairseq.models import FairseqEncoder
from fairseq.models.spe... | 16,097 | 31.920245 | 88 | py |
sign-topic | sign-topic-main/fairseq/models/ema/__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 .ema import EMA
def build_ema(model, cfg, device):
return EMA(model, cfg, device)
# automatically imp... | 599 | 27.571429 | 68 | py |
sign-topic | sign-topic-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 ... | 7,693 | 38.255102 | 86 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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,442 | 29.702128 | 92 | py |
sign-topic | sign-topic-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,097 | 36.93314 | 117 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 .enc_dec import * # noqa
from .model_camembert import * # noqa
from .... | 386 | 31.25 | 65 | py |
sign-topic | sign-topic-main/fairseq/models/roberta/model_gottbert.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
GottBERT: a pure German Language Model
"""
from fairseq.models import register_model
from .hub_interface import RobertaHubInterface
from ... | 1,376 | 26.54 | 90 | py |
sign-topic | sign-topic-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,942 | 37.098039 | 127 | py |
sign-topic | sign-topic-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
from pathlib import Path
from typing import Optional, Dict, Tuple
import random
import torch
import torch.nn as nn
logger = l... | 4,632 | 32.572464 | 88 | py |
sign-topic | sign-topic-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,973 | 36.305495 | 104 | py |
sign-topic | sign-topic-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... | 2,900 | 36.192308 | 92 | py |
sign-topic | sign-topic-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 logging
import json
from typing import Dict
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from... | 8,811 | 33.692913 | 88 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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 weight_norm, remove_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,650 | 30.394444 | 76 | py |
sign-topic | sign-topic-main/fairseq/models/text_to_speech/__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 .tacotron2 import * # noqa
from .tts_transformer import * # noqa
from .fastspeech2 import * # noqa
| 285 | 30.777778 | 65 | py |
sign-topic | sign-topic-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,720 | 34.013363 | 87 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_perceiverIO_preprocessing.py | import math
from functools import reduce
from operator import __add__
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
def build_linear_positions(index_dims, output_range=(-1.0, 1.0)):
"""
Generate an array of position indices for an N-D input array.
Args:
index_dim... | 22,769 | 41.088725 | 119 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_topic_detection_LSTM.py | import logging
logger = logging.getLogger(__name__)
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from fairseq.models.speech_to_text.hub_interface import S2THubInterface # TODO: això haurem de veure en què s'utilitza i... | 21,038 | 36.908108 | 167 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_transformer_encoder.py | #!/usr/bin/env python3
from json import encoder
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from f... | 18,054 | 35.548583 | 162 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/sign2text_transformer.py | #!/usr/bin/env python3
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.data.sign_language... | 16,757 | 35.830769 | 162 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_transformer_encoder_CLS.py | #!/usr/bin/env python3
from ast import AsyncFunctionDef
from json import encoder
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch.nn import init
from torch.nn.parameter import Parameter
from torch import Tensor
from fairs... | 17,298 | 36.042827 | 118 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/__init__.py | # This code is based on the wav2vec 2.0 implementation (commit: 1575f30)
#
# Copyright (c) Facebook, Inc. and 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 .SL_topic_detection_LSTM import *
from .SL_transformer_encode... | 404 | 27.928571 | 72 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_perceiverIO.py | #!/usr/bin/env python3
import logging
import inspect
import math
from pathlib import Path
from typing import Callable
from typing import Optional
from typing import Dict
from typing import List
from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
from .SL_perceiverIO_preprocessing import P... | 55,336 | 41.113394 | 176 | py |
sign-topic | sign-topic-main/fairseq/models/SL_topic_detection/SL_perceiverIO_postprocessing.py | 1 | 0 | 0 | py | |
sign-topic | sign-topic-main/fairseq/models/sign2vec/sign2text_transformer.py | #!/usr/bin/env python3
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.data.sign_language... | 16,790 | 35.822368 | 162 | py |
sign-topic | sign-topic-main/fairseq/models/sign2vec/__init__.py | # This code is based on the wav2vec 2.0 implementation (commit: 1575f30)
#
# Copyright (c) Facebook, Inc. and 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 .sign2text_transformer import *
from .sign2vec import * # noq... | 362 | 32 | 72 | py |
sign-topic | sign-topic-main/fairseq/models/sign2vec/sign2vec_seq2seq.py | # This code is based on the wav2vec 2.0 implementation (commit: 1575f30)
#
# Copyright (c) Facebook, Inc. and its 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 re
from argparse i... | 23,937 | 34.781764 | 96 | py |
sign-topic | sign-topic-main/fairseq/models/sign2vec/sign2vec.py | # This code is based on the wav2vec 2.0 implementation (commit: 1575f30)
#
# Copyright (c) Facebook, Inc. and its 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 im... | 41,337 | 33.362427 | 120 | py |
sign-topic | sign-topic-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 |
sign-topic | sign-topic-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_... | 710 | 32.857143 | 84 | py |
sign-topic | sign-topic-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 fairseq import utils
from fairseq.distribute... | 17,898 | 36.057971 | 104 | py |
sign-topic | sign-topic-main/fairseq/models/transformer/transformer_legacy.py | # Copyright (c) Facebook, Inc. and 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.dataclass.utils import gen_parser_from_dataclass
from fairseq.models import (
register_model,
register_model_architecture... | 13,586 | 48.228261 | 159 | py |
sign-topic | sign-topic-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 fairseq import utils
from fairseq.distributed imp... | 13,389 | 37.587896 | 88 | py |
sign-topic | sign-topic-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,154 | 39.229358 | 175 | py |
sign-topic | sign-topic-main/fairseq/models/transformer/__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.
"""isort:skip_file"""
from .transformer_config import (
TransformerConfig,
DEFAULT_MAX_SOURCE_POSITIONS,
DEFAULT_MAX_TARGET_POSITIO... | 1,488 | 28.196078 | 83 | py |
sign-topic | sign-topic-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 fairseq import utils
from fairseq.dataclass.utils impo... | 6,758 | 36.55 | 102 | py |
sign-topic | sign-topic-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, models, modules # noqa
| 228 | 31.714286 | 65 | py |
sign-topic | sign-topic-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.dataclass.configs import FairseqConfig
from fairseq.distributed import utils as di... | 2,574 | 32.881579 | 80 | py |
sign-topic | sign-topic-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 fairseq.incremental_deco... | 13,304 | 37.014286 | 97 | py |
sign-topic | sign-topic-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.model_parallel.modules import ModelParallelMultiheadAttention
from fairseq.modules import TransformerDecoderLayer, TransformerEnc... | 2,847 | 35.050633 | 79 | py |
sign-topic | sign-topic-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.
"""isort:skip_file"""
from .multihead_attention import ModelParallelMultiheadAttention
from .transformer_layer import (
ModelParallelTrans... | 526 | 28.277778 | 65 | py |
sign-topic | sign-topic-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.mo... | 3,157 | 34.886364 | 82 | py |
sign-topic | sign-topic-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 sorted(os.listdir(os.path.dirnam... | 514 | 33.333333 | 78 | py |
sign-topic | sign-topic-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,
ModelParallel... | 3,907 | 31.032787 | 95 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.