python_code
stringlengths
0
992k
repo_name
stringlengths
8
46
file_path
stringlengths
5
162
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from torch import nn from fairseq.models import FairseqEncoder class CTCDecoder(FairseqEncoder): def __init__(self, dictionary, in_dim)...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_speech/modules/ctc_decoder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn as nn from fairseq.models import FairseqEncoder from fairseq.modules import LayerNorm, TransformerEncoderLayer class Transf...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_speech/modules/transformer_encoder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from torch import nn from fairseq.models.transformer import Linear class StackedEmbedding(nn.Embedding): """Embedding modu...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_speech/modules/stacked_embedding.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List, Optional from torch import Tensor from fairseq.models.transformer import Linear from fairseq.models.tran...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_speech/modules/transformer_decoder_aug.py
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_speech/modules/__init__.py
#!/usr/bin/env python3 import math import torch import torch.nn as nn from fairseq.data.data_utils import compute_mask_indices from fairseq.models import FairseqEncoder from fairseq.models.wav2vec import ConvFeatureExtractionModel from fairseq.modules import GradMultiply, LayerNorm, SamePad, TransformerEncoderLayer ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/s2t_wav_transformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import math from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/convtransformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import logging from typing import Dict, List, Optional, Tuple import numpy as np import torch import torch.nn as nn from torch im...
EXA-1-master
exa/libraries/fairseq/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 logging import math from pathlib import Path import torch from fairseq import checkpoint_utils from fairseq.data.data_utils import le...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/s2t_conformer.py
#!/usr/bin/env python3 from ast import literal_eval from typing import List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from fairseq import checkpoint_utils, utils from fairseq.data.data_utils import lengths_to_padding_mask from fairseq.models import ( FairseqEncoder, FairseqEnc...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/berard.py
# Copyright (c) Facebook, Inc. and 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 .multi_modality_model import * # noqa from .s2t_conformer import * ...
EXA-1-master
exa/libraries/fairseq/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. import logging import math from pathlib import Path from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn from to...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/s2t_transformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.models import FairseqDecoder, FairseqEncoder # a container for different encoders with training samples from different modalit...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/multi_modality_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 copy import logging from fairseq.models import ( FairseqEncoderModel, FairseqLanguageModel, register_model, register_m...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/xm_transformer_unity.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...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/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 logging from argparse import Namespace from typing import Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.fu...
EXA-1-master
exa/libraries/fairseq/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 typing import List import torch import torch.nn as nn class Conv1dSubsampler(nn.Module): """Convolutional subsampler: a stack of ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/modules/convolution.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...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/modules/emformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import List, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from fairseq.models import FairseqE...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/modules/augmented_memory_attention.py
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_to_text/modules/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .hubert import * # noqa from .hubert_asr import * # noqa
EXA-1-master
exa/libraries/fairseq/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. import contextlib import copy import logging import math from argparse import Namespace from dataclasses import dataclass, field from typing i...
EXA-1-master
exa/libraries/fairseq/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 logging from dataclasses import dataclass, field from typing import Dict, List, Optional, Tuple import numpy as np import torch import...
EXA-1-master
exa/libraries/fairseq/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 re from dataclasses import dataclass, field, fields from typing import List, Optional from omegaconf import II from fairseq import u...
EXA-1-master
exa/libraries/fairseq/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. from fairseq.dataclass.utils import gen_parser_from_dataclass from fairseq.models import ( register_model, register_model_architecture...
EXA-1-master
exa/libraries/fairseq/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. import math from typing import Dict, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import utils fr...
EXA-1-master
exa/libraries/fairseq/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. from typing import Any, Dict, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import utils from fair...
EXA-1-master
exa/libraries/fairseq/fairseq/models/transformer/transformer_decoder_aug.py
# Copyright (c) Facebook Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """isort:skip_file""" from .transformer_config import ( TransformerConfig, DEFAULT_MAX_SOURCE_POSITIONS, DEFAULT_MAX_TARGET_POSITIO...
EXA-1-master
exa/libraries/fairseq/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. import math from typing import Any, Dict, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import uti...
EXA-1-master
exa/libraries/fairseq/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. from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn from torch import Tensor import logging from fairseq impo...
EXA-1-master
exa/libraries/fairseq/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. import torch from fairseq.utils import new_arange # -------------- Helper Functions --------------------------------------------------- # ...
EXA-1-master
exa/libraries/fairseq/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.models import register_model, register_model_architecture from fairseq.models.nat import NATransformerModel def _s...
EXA-1-master
exa/libraries/fairseq/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 math import torch from fairseq.models.transformer import ( TransformerDecoder, TransformerEncoder, TransformerModel, ) fro...
EXA-1-master
exa/libraries/fairseq/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. """isort:skip_file""" from .fairseq_nat_model import * from .nonautoregressive_transformer import * from .nat_crf_transformer import * from .i...
EXA-1-master
exa/libraries/fairseq/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. import torch import torch.nn as nn import torch.nn.functional as F from fairseq.iterative_refinement_generator import DecoderOut from fairseq....
EXA-1-master
exa/libraries/fairseq/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 math import torch import torch.nn.functional as F from fairseq.models.nat import ( _apply_del_words, _apply_ins_masks, _ap...
EXA-1-master
exa/libraries/fairseq/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 torch import torch.nn.functional as F from fairseq import utils from fairseq.iterative_refinement_generator import DecoderOut from fair...
EXA-1-master
exa/libraries/fairseq/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. """ This file implements: Ghazvininejad, Marjan, et al. "Constant-time machine translation with conditional masked language models." arXiv pre...
EXA-1-master
exa/libraries/fairseq/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. from fairseq.models import register_model, register_model_architecture from fairseq.models.nat import NATransformerModel, base_architecture f...
EXA-1-master
exa/libraries/fairseq/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. import numpy as np import torch import torch.nn.functional as F from fairseq.models import register_model, register_model_architecture from fa...
EXA-1-master
exa/libraries/fairseq/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. from .hub_interface import * # noqa from .model import * # noqa
EXA-1-master
exa/libraries/fairseq/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. """ BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension """ import logging from t...
EXA-1-master
exa/libraries/fairseq/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. 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 ...
EXA-1-master
exa/libraries/fairseq/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. from fairseq.models import BaseFairseqModel, register_model from fairseq.models.wav2vec.wav2vec2_asr import ( Wav2Vec2CtcConfig, Wav2V...
EXA-1-master
exa/libraries/fairseq/fairseq/models/wav2vec/wav2vec2_laser.py
# Copyright (c) Facebook, Inc. and 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_laser import * # noqa
EXA-1-master
exa/libraries/fairseq/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. import contextlib import copy import logging import math import re from argparse import Namespace from dataclasses import dataclass, field fro...
EXA-1-master
exa/libraries/fairseq/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 math from dataclasses import dataclass, field from typing import List, Tuple import numpy as np import torch import torch.nn as nn imp...
EXA-1-master
exa/libraries/fairseq/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 import torch.nn.functional as F def pad_to_multiple(x, multiple, dim=-1, value=0): # Inspired from https://github.com/lucidr...
EXA-1-master
exa/libraries/fairseq/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. from dataclasses import dataclass, field import logging import math from typing import Optional, Tuple from omegaconf import II import sys im...
EXA-1-master
exa/libraries/fairseq/fairseq/models/wav2vec/wav2vec.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 ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/roberta/enc_dec.py
# Copyright (c) Facebook, Inc. and 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 ...
EXA-1-master
exa/libraries/fairseq/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. """ Unsupervised Cross-lingual Representation Learning at Scale """ from fairseq.models import register_model from .hub_interface import Robe...
EXA-1-master
exa/libraries/fairseq/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. from collections import Counter from typing import List import torch def align_bpe_to_words(roberta, bpe_tokens: torch.LongTensor, other_to...
EXA-1-master
exa/libraries/fairseq/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 .hub_interface import * # noqa from .model import * # noqa from .enc_dec import * # noqa from .model_camembert import * # noqa from ....
EXA-1-master
exa/libraries/fairseq/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. """ RoBERTa: A Robustly Optimized BERT Pretraining Approach. """ import logging import torch import torch.nn as nn import torch.nn.functional...
EXA-1-master
exa/libraries/fairseq/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. """ CamemBERT: a Tasty French Language Model """ from fairseq.models import register_model from .hub_interface import RobertaHubInterface fro...
EXA-1-master
exa/libraries/fairseq/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. 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...
EXA-1-master
exa/libraries/fairseq/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 importlib import os # automatically import any Python files in the models/huggingface/ directory models_dir = os.path.dirname(__file_...
EXA-1-master
exa/libraries/fairseq/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 logging import os import sys from typing import Dict, List, Optional import torch from fairseq.models import ( FairseqIncrementalD...
EXA-1-master
exa/libraries/fairseq/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. from .speech_dlm import * # noqa from .hub_interface import * # noqa
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/__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 logging from dataclasses import dataclass, field from typing import Optional from fairseq import utils from fairseq.dataclass import C...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/speech_dlm.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its 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 Any, Dict, Iterator, List import torch from fairseq import utils from...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/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 math from typing import Any, Dict, List, Optional, Tuple import torch import torch.nn as nn from fairseq import utils from fairseq.mod...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/modules/speech_dlm_decoder.py
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/modules/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, List, Tuple, Optional import torch import torch.nn as nn from fairseq import utils from fairseq.modules import Layer...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/modules/speech_dlm_decoder_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 math from typing import Dict, List, Optional from omegaconf.listconfig import ListConfig from omegaconf.dictconfig import DictConfig ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/sequence_generator/multichannel_sequence_generator.py
# Copyright (c) Facebook, Inc. and 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 .multichannel_sequence_generator import * # noqa
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/sequence_generator/__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 typing import Dict, Optional import torch import torch.nn as nn from torch import Tensor class MultichannelSearch(nn.Module): def ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/speech_dlm/sequence_generator/multichannel_search.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import logging from typing import Dict import numpy as np import torch import torch.nn.functional as F from torch import nn from...
EXA-1-master
exa/libraries/fairseq/fairseq/models/text_to_speech/vocoder.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...
EXA-1-master
exa/libraries/fairseq/fairseq/models/text_to_speech/codehifigan.py
# Copyright (c) Facebook, Inc. and its 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...
EXA-1-master
exa/libraries/fairseq/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. from .tacotron2 import * # noqa from .tts_transformer import * # noqa from .fastspeech2 import * # noqa from .vocoder import * # noqa
EXA-1-master
exa/libraries/fairseq/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. import logging import torch from torch import nn from fairseq import utils from fairseq.data.data_utils import lengths_to_padding_mask from ...
EXA-1-master
exa/libraries/fairseq/fairseq/models/text_to_speech/fastspeech2.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Conv1d, ConvTranspose1d from torch.nn.utils import remove_weight_norm, weight_norm LRELU_SLOPE = 0.1 def init_weights(m, mean=0.0, std=0.01): classname = m.__class__.__name__ if classname.find("Conv") != -1: m.wei...
EXA-1-master
exa/libraries/fairseq/fairseq/models/text_to_speech/hifigan.py
# Copyright (c) Facebook, Inc. and its 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...
EXA-1-master
exa/libraries/fairseq/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 import random from pathlib import Path from typing import Dict, Optional, Tuple import torch import torch.nn as nn logger = l...
EXA-1-master
exa/libraries/fairseq/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. from fairseq.modules.transformer_layer import TransformerEncoderLayer from typing import Optional import torch import torch.nn as nn from fair...
EXA-1-master
exa/libraries/fairseq/fairseq/models/xmod/transformer_layer_xmod.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from .model import * # noqa from .transformer_layer_xmod import * # noqa
EXA-1-master
exa/libraries/fairseq/fairseq/models/xmod/__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 ..roberta.model_xlmr import XLMRModel from fairseq.models.xmod.transformer_layer_xmod import XMODTransformerEncoderLayerBase from ..rober...
EXA-1-master
exa/libraries/fairseq/fairseq/models/xmod/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.models.roberta.hub_interface import RobertaHubInterface import torch import torch.nn.functional as F class XMODHubInterface(Ro...
EXA-1-master
exa/libraries/fairseq/fairseq/models/xmod/hub_interface.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Train a network across multiple GPUs. """ from fairseq.dataclass.configs import FairseqConfig from fairseq.distributed import utils as di...
EXA-1-master
exa/libraries/fairseq/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. from . import criterions, models, modules # noqa
EXA-1-master
exa/libraries/fairseq/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. import importlib import os # automatically import any Python files in the models/ directory models_dir = os.path.dirname(__file__) for file ...
EXA-1-master
exa/libraries/fairseq/fairseq/model_parallel/models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch.nn as nn from fairseq.model_parallel.modules import ( ModelParallelTransformerDecoderLayer, ModelParalle...
EXA-1-master
exa/libraries/fairseq/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 torch.nn as nn from fairseq.model_parallel.models.transformer import ModelParallelTransformerDecoder from fairseq.models import regist...
EXA-1-master
exa/libraries/fairseq/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. from .model import * # noqa
EXA-1-master
exa/libraries/fairseq/fairseq/model_parallel/models/pipeline_parallel_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. import logging import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.model_parallel.model...
EXA-1-master
exa/libraries/fairseq/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 math from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F from fairseq import option...
EXA-1-master
exa/libraries/fairseq/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. from .model import * # noqa
EXA-1-master
exa/libraries/fairseq/fairseq/model_parallel/models/roberta/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ RoBERTa: A Robustly Optimized BERT Pretraining Approach. """ import logging import torch import torch.nn as nn import torch.nn.functional...
EXA-1-master
exa/libraries/fairseq/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. from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from torch import Tensor, nn from fairseq import utils...
EXA-1-master
exa/libraries/fairseq/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. """isort:skip_file""" from .multihead_attention import ModelParallelMultiheadAttention from .transformer_layer import ( ModelParallelTrans...
EXA-1-master
exa/libraries/fairseq/fairseq/model_parallel/modules/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.model_parallel.modules import ModelParallelMultiheadAttention from fairseq.modules import TransformerDecoderLayer, TransformerEnc...
EXA-1-master
exa/libraries/fairseq/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. import math from fairseq import utils from fairseq.logging import metrics from fairseq.criterions import FairseqCriterion, register_criterion...
EXA-1-master
exa/libraries/fairseq/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 importlib import os # automatically import any Python files in the criterions/ directory for file in sorted(os.listdir(os.path.dirnam...
EXA-1-master
exa/libraries/fairseq/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. from dataclasses import dataclass, field import numpy as np from fairseq.dataclass import FairseqDataclass from fairseq.scoring import BaseS...
EXA-1-master
exa/libraries/fairseq/fairseq/scoring/bertscore.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ctypes import math import sys from dataclasses import dataclass, field import torch from fairseq.dataclass import FairseqDataclass fro...
EXA-1-master
exa/libraries/fairseq/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 importlib import os from abc import ABC, abstractmethod from fairseq import registry from omegaconf import DictConfig class BaseSco...
EXA-1-master
exa/libraries/fairseq/fairseq/scoring/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from fairseq.dataclass import FairseqDataclass from fairseq.scoring import BaseScorer, register_scor...
EXA-1-master
exa/libraries/fairseq/fairseq/scoring/wer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unicodedata import sacrebleu as sb from fairseq.dataclass import ChoiceEnum SACREBLEU_V2_ABOVE = int(sb.__version__[0]) >= 2 class...
EXA-1-master
exa/libraries/fairseq/fairseq/scoring/tokenizer.py