repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/convtransformer.py | fairseq/models/speech_to_text/convtransformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/s2t_conformer.py | fairseq/models/speech_to_text/s2t_conformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
from pathlib import Path
import torch
from fairseq import checkpoint_utils
from fairseq.data.data_utils import le... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/s2t_transformer.py | fairseq/models/speech_to_text/s2t_transformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
from to... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/xm_transformer.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/berard.py | fairseq/models/speech_to_text/berard.py | #!/usr/bin/env python3
from ast import literal_eval
from typing import List, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import checkpoint_utils, utils
from fairseq.data.data_utils import lengths_to_padding_mask
from fairseq.models import (
FairseqEncoder,
FairseqEnc... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/utils.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/__init__.py | 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 .multi_modality_model import * # noqa
from .s2t_conformer import * ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/multi_modality_model.py | 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.
from fairseq.models import FairseqDecoder, FairseqEncoder
# a container for different encoders with training samples from different modalit... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/s2t_wav_transformer.py | fairseq/models/speech_to_text/s2t_wav_transformer.py | #!/usr/bin/env python3
import math
import torch
import torch.nn as nn
from fairseq.data.data_utils import compute_mask_indices
from fairseq.models import FairseqEncoder
from fairseq.models.wav2vec import ConvFeatureExtractionModel
from fairseq.modules import GradMultiply, LayerNorm, SamePad, TransformerEncoderLayer
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/hub_interface.py | fairseq/models/speech_to_text/hub_interface.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from argparse import Namespace
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.fu... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/modules/convolution.py | fairseq/models/speech_to_text/modules/convolution.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
import torch
import torch.nn as nn
class Conv1dSubsampler(nn.Module):
"""Convolutional subsampler: a stack of ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/modules/augmented_memory_attention.py | fairseq/models/speech_to_text/modules/augmented_memory_attention.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Tuple
import torch
import torch.nn.functional as F
from torch import Tensor, nn
from fairseq.models import FairseqE... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/modules/__init__.py | fairseq/models/speech_to_text/modules/__init__.py | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false | |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_text/modules/emformer.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | true |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/s2s_transformer.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/s2s_conformer.py | fairseq/models/speech_to_speech/s2s_conformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from pathlib import Path
import torch
from fairseq import checkpoint_utils
from fairseq.models import register_model, registe... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/s2s_conformer_translatotron2.py | fairseq/models/speech_to_speech/s2s_conformer_translatotron2.py | # Copyright (c) Facebook, Inc. and its 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/s2s_conformer_unity.py | fairseq/models/speech_to_speech/s2s_conformer_unity.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import logging
from fairseq.models import (
FairseqEncoder,
FairseqEncoderModel,
FairseqLanguageModel,
register_m... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/__init__.py | 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 .s2s_conformer import * # noqa
from .s2s_conformer_translatotron2 import * # noqa
from .s2s_conformer_unity import * # noqa
from .s2s_... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/modules/ctc_decoder.py | fairseq/models/speech_to_speech/modules/ctc_decoder.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from torch import nn
from fairseq.models import FairseqEncoder
class CTCDecoder(FairseqEncoder):
def __init__(self, dictionary, in_dim)... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/modules/__init__.py | fairseq/models/speech_to_speech/modules/__init__.py | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false | |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/modules/stacked_embedding.py | fairseq/models/speech_to_speech/modules/stacked_embedding.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
from fairseq.models.transformer import Linear
class StackedEmbedding(nn.Embedding):
"""Embedding modu... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/modules/transformer_decoder_aug.py | fairseq/models/speech_to_speech/modules/transformer_decoder_aug.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, List, Optional
from torch import Tensor
from fairseq.models.transformer import Linear
from fairseq.models.tran... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/models/speech_to_speech/modules/transformer_encoder.py | fairseq/models/speech_to_speech/modules/transformer_encoder.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from fairseq.models import FairseqEncoder
from fairseq.modules import LayerNorm, TransformerEncoderLayer
class Transf... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/module_proxy_wrapper.py | fairseq/distributed/module_proxy_wrapper.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from torch import nn
class ModuleProxyWrapper(nn.Module):
"""
Wrap a DistributedDataParallel module and forward requests for missing... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/fully_sharded_data_parallel.py | fairseq/distributed/fully_sharded_data_parallel.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
from typing import Optional
import torch
from fairseq.dataclass.configs import DistributedTrainingConfig
from fairseq.distr... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/utils.py | fairseq/distributed/utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import io
import logging
import os
import pickle
import random
import socket
import struct
import subprocess
import warnings
from argparse imp... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/legacy_distributed_data_parallel.py | fairseq/distributed/legacy_distributed_data_parallel.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
A modified version of the legacy DistributedDataParallel module that uses c10d
communication primitives. This version is simpler than the ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/__init__.py | fairseq/distributed/__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 .distributed_timeout_wrapper import DistributedTimeoutWrapper
from .fully_sharded_data_parallel import (
fsdp_enable_wrap,
fsdp_w... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/tpu_distributed_data_parallel.py | fairseq/distributed/tpu_distributed_data_parallel.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
from fairseq.distributed import utils
class TPUDistributedDataParallel(nn.Module):
def __init__(self,... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/distributed/distributed_timeout_wrapper.py | fairseq/distributed/distributed_timeout_wrapper.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import signal
import threading
from torch import nn
logger = logging.getLogger(__name__)
class DistributedTimeou... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/amp_optimizer.py | fairseq/optim/amp_optimizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import torch
from fairseq import optim
from omegaconf import DictConfig
logger = logging.getLogger(__name__)
class AMPOptim... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/bmuf.py | fairseq/optim/bmuf.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
import torch
import torch.distributed as dist
from fairseq.dataclass.configs import FairseqBMUFConfi... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/composite.py | fairseq/optim/composite.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Dict, Any, List, Optional
impo... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/fused_lamb.py | fairseq/optim/fused_lamb.py | # Copyright (c) Facebook, Inc. and 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.optim import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("lamb")
class FairseqLAMB(LegacyFairseqOptimizer):
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/adamax.py | fairseq/optim/adamax.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adamax")
class FairseqAdamax(... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/fairseq_optimizer.py | fairseq/optim/fairseq_optimizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq import utils
from fairseq.dataclass.utils import gen_parser_from_dataclass
from collections import defaultdict
cla... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/adam.py | fairseq/optim/adam.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import math
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import Any, List
impor... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/nag.py | fairseq/optim/nag.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
import torch
from fairseq.dataclass i... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/adagrad.py | fairseq/optim/adagrad.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adagrad")
class Adagrad(LegacyFairseqOptim... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/adadelta.py | fairseq/optim/adadelta.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adadelta")
class Adadelta(LegacyFairseqOpt... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/fused_adam.py | fairseq/optim/fused_adam.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import types
import torch
def get_fused_adam_class():
"""
Look for the FusedAdam optimizer from apex. We first try to load the
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/dynamic_loss_scaler.py | fairseq/optim/dynamic_loss_scaler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class DynamicLossScaler(object):
def __init__(
self,
init_scale=2.0**15,
scale_factor=2.0,
scale_window=2... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/shard.py | fairseq/optim/shard.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict
from fairseq.distributed import utils
try:
from fairscale.optim import OSS
_has_fairscale = True
exce... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/fp16_optimizer.py | fairseq/optim/fp16_optimizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import defaultdict
from itertools import chain
import torch
from omegaconf import DictConfig
from fairseq import optim
fro... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/__init__.py | fairseq/optim/__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.optim.bmuf import FairseqBMUF # noqa
from fairseq... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/sgd.py | fairseq/optim/sgd.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("sgd")
class SGD(LegacyFairseqOptimizer):
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/adafactor.py | fairseq/optim/adafactor.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.optim
from . import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adafactor")
clas... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/cpu_adam.py | fairseq/optim/cpu_adam.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
import torch
from fa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/fixed_schedule.py | fairseq/optim/lr_scheduler/fixed_schedule.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
from typing import Optional, List
from omegaconf import II
from fairseq.dataclass import FairseqData... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/cosine_lr_scheduler.py | fairseq/optim/lr_scheduler/cosine_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/inverse_square_root_schedule.py | fairseq/optim/lr_scheduler/inverse_square_root_schedule.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
from fairse... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/tri_stage_lr_scheduler.py | fairseq/optim/lr_scheduler/tri_stage_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from typing import Optional, List, Tuple
from omegaconf import II
from fairseq.dataclass... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/manual_lr_scheduler.py | fairseq/optim/lr_scheduler/manual_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from . import LegacyFairseqLRScheduler, register_lr_scheduler
import logging
import ast
logger = logging.getLogger(__name__)
logger.setLevel(... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/pass_through.py | fairseq/optim/lr_scheduler/pass_through.py | # Copyright (c) Facebook, Inc. and 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
from fairseq.dataclass import FairseqDataclass
from fairseq.optim.lr_scheduler import FairseqLRScheduler, r... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/triangular_lr_scheduler.py | fairseq/optim/lr_scheduler/triangular_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
from fairseq.dataclass import FairseqD... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/step_lr_scheduler.py | fairseq/optim/lr_scheduler/step_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections.abc import Collection
from dataclasses import dataclass, field
from typing import List
from omegaconf import II
from fairse... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py | fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
from fairseq.dataclass.utils import gen_parser_from_dataclass
from fairseq.optim import FairseqOptimizer
cla... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/polynomial_decay_schedule.py | fairseq/optim/lr_scheduler/polynomial_decay_schedule.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
from typing import Optional, List
from omegaconf import II
from fairseq.dataclass import FairseqData... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/__init__.py | fairseq/optim/lr_scheduler/__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.optim.lr_scheduler.fairseq_lr_scheduler import ( ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py | fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass, field
from typing import List
import torch.optim.lr_scheduler
from omegaconf import II
from fairseq.datac... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/label_smoothed_cross_entropy.py | 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 utils
from fairseq.logging import metrics
from fairseq.... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/model_criterion.py | 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
import torch
from fairseq import utils
from fairseq.lo... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/speech_to_speech_criterion.py | fairseq/criterions/speech_to_speech_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
import math
from collections import OrderedDict
import torch
from fairseq import utils
from fairseq.logging import metrics
fr... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/speech_dlm_criterion.py | fairseq/criterions/speech_dlm_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 Optional
import torch.nn.functional as F
from fairseq import metrics,... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/wav2vec_criterion.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/speech_ulm_criterion.py | fairseq/criterions/speech_ulm_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 torch
from dataclasses import dataclass, field
import torch.nn.functional as F
from fairseq.logging import metrics
from fairseq.tasks ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py | 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 utils
from fairseq.logging import metrics
from fairseq.criterions im... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/sentence_prediction.py | 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
from itertools import chain
import numpy as np
import torch
import torch.nn.functional a... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/hubert_criterion.py | fairseq/criterions/hubert_criterion.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import re
from dataclasses import dataclass, field
from typing import List, Optional
import torch
import torch.nn.functional as F... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/tacotron2_loss.py | 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 dataclasses im... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/nat_loss.py | 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 utils
from fairseq.logging import metrics
from fairseq.criterion... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/sentence_prediction_adapters.py | fairseq/criterions/sentence_prediction_adapters.py | # Copyright (c) Facebook, Inc. and its 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.criterions import register_criterion
from fairseq.criterions.sentence_prediction imp... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/cross_entropy.py | fairseq/criterions/cross_entropy.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass
import torch.nn.functional as F
from fairseq import utils
from fairseq.logging import metrics
f... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/ctc.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/fairseq_criterion.py | 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 utils
from fairseq.logging import metrics
from fairseq.dataclass import... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/__init__.py | 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
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/sentence_ranking.py | 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 utils
from fairseq.logging import metrics
from fairseq.criterion... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/composite_loss.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/masked_lm.py | 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 modules, utils
from fairseq.logging i... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/fastspeech2_loss.py | 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... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py | 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 utils
from fairseq.logging import metrics
from fairseq.criterions import register_criterion
from .label_smoo... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/legacy_masked_lm.py | 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 utils
from fairseq.logging import metrics
from fairseq.criterion... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/label_smoothed_cross_entropy_with_ctc.py | fairseq/criterions/label_smoothed_cross_entropy_with_ctc.py | # Copyright (c) Facebook, Inc. and its 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 utils
from fairseq.log... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/adaptive_loss.py | 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 utils
from fairseq.logging import metrics
f... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/criterions/label_smoothed_cross_entropy_with_rdrop.py | fairseq/criterions/label_smoothed_cross_entropy_with_rdrop.py | # Copyright (c) Facebook, Inc. and its 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 utils
from fairseq.logging import metrics
from fairseq... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/transformer_layer.py | fairseq/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 typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from fairseq import utils
from fairseq.m... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/fp32_group_norm.py | fairseq/modules/fp32_group_norm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Layer norm done in fp32 (for fp16 training)
"""
import torch.nn as nn
import torch.nn.functional as F
class Fp32GroupNorm(nn.GroupNorm):... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/sparse_multihead_attention.py | fairseq/modules/sparse_multihead_attention.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
from .multihead_attention import MultiheadAttention
class SparseMultiheadAttention(MultiheadAttention):
"""Sp... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/transformer_sentence_encoder.py | fairseq/modules/transformer_sentence_encoder.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional, Tuple
import torch
import torch.nn as nn
from fairseq.modules import (
FairseqDropout,
LayerDropModuleLi... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/linearized_convolution.py | fairseq/modules/linearized_convolution.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn.functional as F
from fairseq import utils
from fairseq.incremental_decoding_utils import with_incremental_state
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/location_attention.py | fairseq/modules/location_attention.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
import torch
import torch.nn.functional as F
class LocationAttention(nn.Module):
"""
Attention-Based Models fo... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/lstm_cell_with_zoneout.py | fairseq/modules/lstm_cell_with_zoneout.py | # Copyright (c) Facebook, Inc. and its 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
class LSTMCellWithZoneOut(nn.Module):
"""
Zoneout: Regularizing RNNs by Randomly Preserving Hidden Activations... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/kmeans_attention.py | fairseq/modules/kmeans_attention.py | import math
from functools import reduce, wraps
from inspect import isfunction
from operator import mul
import torch
import torch.nn as nn
import torch.nn.functional as F
from aml.multimodal_video.utils.einops.lib import rearrange, repeat
from aml.multimodal_video.utils.einops.lib.layers.torch import Rearrange
from f... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/beamable_mm.py | fairseq/modules/beamable_mm.py | # Copyright (c) Facebook, Inc. and its 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
class BeamableMM(nn.Module):
"""This module provides an optimized MM for beam decoding with attention... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/quant_noise.py | fairseq/modules/quant_noise.py | # Copyright (c) Facebook, Inc. and its 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
def quant_noise(module, p, block_size):
"""
Wraps modules and applies quantization noise to the w... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/sparse_transformer_sentence_encoder.py | fairseq/modules/sparse_transformer_sentence_encoder.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from fairseq.modules import TransformerSentenceEncoder
from fairseq.modules.sparse_transformer_sentence_encoder_layer im... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/positional_embedding.py | fairseq/modules/positional_embedding.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from .learned_positional_embedding import LearnedPositionalEmbedding
from .sinusoidal_positional_embedding import Sinus... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/grad_multiply.py | fairseq/modules/grad_multiply.py | # Copyright (c) Facebook, Inc. and its 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
class GradMultiply(torch.autograd.Function):
@staticmethod
def forward(ctx, x, scale):
ctx.scale = scale
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/fairseq/modules/unfold.py | fairseq/modules/unfold.py | # Copyright (c) Facebook, Inc. and its 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.functional as F
def unfold1d(x, kernel_size: int, padding_l: int, pad_value: float = 0):
"""unfold T x B x C to T x B x ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.