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 |
|---|---|---|---|---|---|---|
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/tacotron2_loss.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 typing import ... | 8,535 | 35.478632 | 88 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/speech_text_pretraining_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 os
import sys
import math
import numpy as np
from dataclasses import dataclass, field
from typing import List, Optional
import torch
i... | 21,721 | 39.225926 | 87 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/nar_cif.py | # @Time : 2021/7/14
# @Author : Minglun Han
# @File : nar_cif.py
import sys
import math
import editdistance
import numpy as np
from argparse import Namespace
from dataclasses import dataclass, field
from omegaconf import II
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.function... | 14,961 | 39.005348 | 96 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/fairseq_criterion.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import inspect
from typing import Any, Dict, List
from fairseq import metrics, utils
from fairseq.dataclass import FairseqDataclass
from fair... | 4,424 | 35.570248 | 79 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/nat_loss.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | 6,355 | 34.116022 | 88 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py | # Copyright (c) Facebook, Inc. and 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
from fairseq import metrics, utils
from fairseq.criterions import register_criterion
fro... | 7,969 | 35.063348 | 88 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/model_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 logging
from dataclasses import dataclass, field
from typing import Dict, List
from fairseq import metrics, utils
from fairseq.criteri... | 4,827 | 33.733813 | 88 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/wav2vec_criterion.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from typing import List, Optional
import torch
import torch.nn.functional as F
from fair... | 9,178 | 37.567227 | 100 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/legacy_masked_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | 7,006 | 38.365169 | 87 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py | # Copyright (c) Facebook, Inc. and its 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 register_criterion
from .label_smoothed_cross_entropy import (... | 4,748 | 35.251908 | 114 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/adaptive_loss.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions impo... | 4,558 | 35.766129 | 105 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/masked_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
import math
from omegaconf import II
import torch
from fairseq import metrics, modules, utils
from fairseq.... | 3,402 | 33.373737 | 79 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/fastspeech2_loss.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.
from typing import List, Dict, Any... | 5,604 | 39.035714 | 85 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/ctc.py | # All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from argparse import Namespace
from dataclasses import dataclass, f... | 11,065 | 36.385135 | 104 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/cross_entropy.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import math
import torch
import logging
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq i... | 5,192 | 35.829787 | 112 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
import importlib
import os
from fairseq import registry
from fairseq.criterions.fairseq_criterion import ( # noqa
... | 997 | 25.972973 | 71 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/sentence_prediction.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fai... | 3,927 | 36.409524 | 96 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/cif_correction_loss.py | # @Time : 2021/7/14
# @Author : Minglun Han
# @File : cif_correction_loss.py
"""""
Update:
By 2022/0805
1. Add monitoring for negative correction loss and positive correction loss (done);
2. Freeze the batch normalization parameters for Conformer structure (done);
3. Remove redun... | 42,370 | 41.626761 | 111 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/cif_tf_correction_loss.py | # @Time : 2021/7/14
# @Author : Minglun Han
# @File : cif.py
import sys
import math
import editdistance
import numpy as np
from argparse import Namespace
from dataclasses import dataclass, field
from omegaconf import II
from typing import Optional
import torch
import torch.nn.functional as F
from fairseq impor... | 37,173 | 42.32634 | 109 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/label_smoothed_cross_entropy.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
import torch
from fairseq import metrics, utils
from fairseq.criterions import FairseqCr... | 7,830 | 36.830918 | 86 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/sentence_ranking.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, ... | 4,614 | 37.140496 | 87 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/criterions/composite_loss.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import utils
from fairseq.criterions import LegacyFairseqCriterion, register_criterion
from torch import nn
@register_criterion... | 3,793 | 36.564356 | 93 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,651 | 36.894118 | 165 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,408 | 34.68007 | 98 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,741 | 37.536913 | 132 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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.
from argparse import Namespace
import contextlib
import copy
import math
import numpy as np
import re
import torch
import torch.nn as nn
impor... | 25,307 | 34.395804 | 96 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/wav2vec/wav2vec2_nar_cif_asr.py | # @Time : 2021/11/1
# @Author : Minglun Han
# @File : wav2vec2_nar_cif_asr.py
from argparse import Namespace
import logging
import sys
import contextlib
import copy
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from dataclas... | 28,462 | 39.37305 | 112 | py |
CIF-HieraDist | CIF-HieraDist-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... | 34,747 | 32.768707 | 119 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/wav2vec/speech_text_pretraining_model.py | # @Time : 2021/11/24
# @Author : Minglun Han
# @File : speech_text_pretraining_model.py
import math
import random
import logging
from dataclasses import dataclass, field
from typing import List, Tuple, Dict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq impor... | 106,389 | 38.056535 | 119 | py |
CIF-HieraDist | CIF-HieraDist-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
from .wav2vec2_nar_cif_asr import *
from .s... | 358 | 31.636364 | 65 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,517 | 39.306494 | 101 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from dataclasses import ... | 19,029 | 34.371747 | 87 | py |
CIF-HieraDist | CIF-HieraDist-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,353 | 33.127072 | 88 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/speech_to_text/s2t_cif_transformer.py | #!/usr/bin/env python3
import sys
import logging
import argparse
import math
import copy
import edlib
import numpy as np
from typing import Dict, List, Optional, Tuple, Any
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils, utils, tasks
fr... | 139,663 | 38.264549 | 112 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/speech_to_text/xm_transformer.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import copy
from typing import Dict, List, Optional, Tuple
from fairseq import utils, checkpoint_utils
... | 19,926 | 34.583929 | 88 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/speech_to_text/cif_transformer.py | # @Time : 2022/1/20
# @Author : Minglun Han
# @File : cif_transformer.py
import sys
import logging
import math
from typing import Dict, List, Optional, Tuple
from pathlib import Path
import torch
import torch.nn as nn
import numpy as np
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils i... | 91,976 | 43.071394 | 112 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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... | 406 | 32.916667 | 65 | py |
CIF-HieraDist | CIF-HieraDist-main/fairseq/models/speech_to_text/s2t_transformer.py | #!/usr/bin/env python3
import logging
import math
from typing import Dict, List, Optional, Tuple
from pathlib import Path
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,
Fair... | 19,248 | 35.875479 | 97 | py |
CIF-HieraDist | CIF-HieraDist-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,267 | 36.183007 | 97 | py |
CIF-HieraDist | CIF-HieraDist-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,095 | 32.051335 | 88 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,692 | 38.451282 | 86 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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... | 22,452 | 36.609715 | 113 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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.models import (
FairseqEncoder,
Fair... | 15,432 | 37.5825 | 104 | py |
CIF-HieraDist | CIF-HieraDist-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... | 7,429 | 32.772727 | 84 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,528 | 30.775862 | 76 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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.models import (
FairseqEncoder,
FairseqEncoderModel,
register_mode... | 17,259 | 34.441478 | 89 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,896 | 36.05383 | 104 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,756 | 36.538889 | 102 | py |
CIF-HieraDist | CIF-HieraDist-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 |
CIF-HieraDist | CIF-HieraDist-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,570 | 32.828947 | 80 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.