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/examples/unsupervised_quality_estimation/repeat_lines.py
examples/unsupervised_quality_estimation/repeat_lines.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import sys def _normalize_spaces(line): return " ".join(line.split()) def main(): parser = argparse.ArgumentParser...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/unsupervised_quality_estimation/aggregate_scores.py
examples/unsupervised_quality_estimation/aggregate_scores.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import sys import numpy as np aggregate_funcs = { "std": np.std, "var": np.var, "median": np.median, "mean"...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/translation_moe/score.py
examples/translation_moe/score.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Scoring script for computing pairwise BLEU and multi-ref BLEU over a set of candidate hypotheses. See `"Mixture Mod...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/translation_moe/translation_moe_src/logsumexp_moe.py
examples/translation_moe/translation_moe_src/logsumexp_moe.py
# Copyright (c) Facebook, Inc. and its 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 LogSumExpMoE(torch.autograd.Function): """Standard LogSumExp forward pass, but use *posterior* for the backward. ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/translation_moe/translation_moe_src/mean_pool_gating_network.py
examples/translation_moe/translation_moe_src/mean_pool_gating_network.py
# Copyright (c) Facebook, Inc. and its 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 class MeanPoolGatingNetwork(torch.nn.Module): """A simple mean-pooling gating network for s...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/translation_moe/translation_moe_src/translation_moe.py
examples/translation_moe/translation_moe_src/translation_moe.py
# Copyright (c) Facebook, Inc. and 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 omegaconf import II from fairseq import utils from fairseq.logging import metrics ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/translation_moe/translation_moe_src/__init__.py
examples/translation_moe/translation_moe_src/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import translation_moe # noqa
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/infer.py
examples/speech_recognition/infer.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. """ Run inference for pre-processed data with a trained model. """ import ast import logging import math import os ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/__init__.py
examples/speech_recognition/__init__.py
from . import criterions, models, tasks # noqa
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/w2l_decoder.py
examples/speech_recognition/w2l_decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Flashlight decoders. """ import gc import itertools as it import os.path as osp from typing import List import wa...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/tasks/speech_recognition.py
examples/speech_recognition/tasks/speech_recognition.py
# Copyright (c) Facebook, Inc. and its 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 os import re import sys import torch from examples.speech_recognition.data import AsrDataset from examples.speech_recognit...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/tasks/__init__.py
examples/speech_recognition/tasks/__init__.py
import importlib import os for file in sorted(os.listdir(os.path.dirname(__file__))): if file.endswith(".py") and not file.startswith("_"): task_name = file[: file.find(".py")] importlib.import_module("examples.speech_recognition.tasks." + task_name)
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/infer.py
examples/speech_recognition/new/infer.py
#!/usr/bin/env python -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 ast import hashlib import logging import os import shutil import sys import re from dataclasses import datacla...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/__init__.py
examples/speech_recognition/new/__init__.py
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/decoder.py
examples/speech_recognition/new/decoders/decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Union from fairseq.data.dictionary import Dictionary from .decoder_config import DecoderConfig, F...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/base_decoder.py
examples/speech_recognition/new/decoders/base_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 itertools as it from typing import Any, Dict, List import torch from fairseq.data.dictionary import Dictionary from fairseq.models.fai...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/viterbi_decoder.py
examples/speech_recognition/new/decoders/viterbi_decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from typing import List, Dict from .base_decoder import BaseDecoder class ViterbiDecoder(BaseDecoder)...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/decoder_config.py
examples/speech_recognition/new/decoders/decoder_config.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass, field from typing import Optional from fairseq.dataclass.configs import FairseqDataclass from ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/__init__.py
examples/speech_recognition/new/decoders/__init__.py
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/new/decoders/flashlight_decoder.py
examples/speech_recognition/new/decoders/flashlight_decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import gc import os.path as osp import warnings from collections import deque, namedtuple from typing import Any, Dict...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/kaldi/kaldi_decoder.py
examples/speech_recognition/kaldi/kaldi_decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from concurrent.futures import ThreadPoolExecutor import logging from omegaconf import MISSING import os import torch ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/kaldi/kaldi_initializer.py
examples/speech_recognition/kaldi/kaldi_initializer.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass import hydra from hydra.core.config_store import ConfigStore import logging from ome...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/kaldi/__init__.py
examples/speech_recognition/kaldi/__init__.py
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/datasets/asr_prep_json.py
examples/speech_recognition/datasets/asr_prep_json.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import argparse import concurrent.f...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/models/w2l_conv_glu_enc.py
examples/speech_recognition/models/w2l_conv_glu_enc.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.models import ( Fairs...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/models/vggtransformer.py
examples/speech_recognition/models/vggtransformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import math from collections.abc import Iterable import torch import torch.nn as nn from examples.speech_recognition.data.dat...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
true
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/models/__init__.py
examples/speech_recognition/models/__init__.py
import importlib import os for file in sorted(os.listdir(os.path.dirname(__file__))): if file.endswith(".py") and not file.startswith("_"): model_name = file[: file.find(".py")] importlib.import_module("examples.speech_recognition.models." + model_name)
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/utils/wer_utils.py
examples/speech_recognition/utils/wer_utils.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import re from collections import ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/criterions/ASG_loss.py
examples/speech_recognition/criterions/ASG_loss.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from examples.speech_recognition.data.replabels import pack_replabels from fairseq import utils from fair...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/criterions/cross_entropy_acc.py
examples/speech_recognition/criterions/cross_entropy_acc.py
# Copyright (c) Facebook, Inc. and 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 __future__ import absolute_import, division, print_function, unicode_literals import logging import math import torch import torch.nn.f...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/criterions/__init__.py
examples/speech_recognition/criterions/__init__.py
import importlib import os # ASG loss requires flashlight bindings files_to_skip = set() try: import flashlight.lib.sequence.criterion except ImportError: files_to_skip.add("ASG_loss.py") for file in sorted(os.listdir(os.path.dirname(__file__))): if file.endswith(".py") and not file.startswith("_") and f...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/data/data_utils.py
examples/speech_recognition/data/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch def calc_mean_invstddev(feature): if len(feature.size()) != 2: raise ValueError("We expect the input feature to be ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/data/replabels.py
examples/speech_recognition/data/replabels.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Replabel transforms for use with flashlight's ASG criterion. """ def replabel_symbol(i): """ Replabel sy...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/data/asr_dataset.py
examples/speech_recognition/data/asr_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import numpy as np from fairseq.data import FairseqDataset from . import data_utils from .collaters import Seq2SeqCollater class...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/data/collaters.py
examples/speech_recognition/data/collaters.py
# Copyright (c) Facebook, Inc. and 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 module contains collection of classes which implement collate functionalities for various tasks. Collaters should know wh...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_recognition/data/__init__.py
examples/speech_recognition/data/__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 .asr_dataset import AsrDataset __all__ = [ "AsrDataset", ]
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/data_utils.py
examples/speech_synthesis/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import io import os from pathlib import Path from typing import Optional, List, Dict import zipfile import tempfile from dataclasses import da...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/utils.py
examples/speech_synthesis/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 numpy as np import torch from scipy.interpolate import interp1d import torchaudio from fairseq.tasks.text_to_speech import ( batch...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/generate_waveform.py
examples/speech_synthesis/generate_waveform.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import logging import matplotlib.pyplot as plt import numpy as np from pathlib import Path import soundfile as sf import sys import...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/__init__.py
examples/speech_synthesis/__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.
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/get_feature_manifest.py
examples/speech_synthesis/preprocessing/get_feature_manifest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile from collections import Counter,...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/get_common_voice_audio_manifest.py
examples/speech_synthesis/preprocessing/get_common_voice_audio_manifest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path from collections import defaultdict from typing import List, Dict, Tuple import panda...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/get_speaker_embedding.py
examples/speech_synthesis/preprocessing/get_speaker_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 argparse from collections import defaultdict from itertools import chain from pathlib import Path import numpy as np import torchaudi...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/get_ljspeech_audio_manifest.py
examples/speech_synthesis/preprocessing/get_ljspeech_audio_manifest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path from collections import defaultdict import pandas as pd from torchaudio.datasets impo...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/__init__.py
examples/speech_synthesis/preprocessing/__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.
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoise_and_vad_audio.py
examples/speech_synthesis/preprocessing/denoise_and_vad_audio.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os import csv import tempfile from collections import defaultdict from pathlib import Path import torch...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/get_vctk_audio_manifest.py
examples/speech_synthesis/preprocessing/get_vctk_audio_manifest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import numpy as np import re from pathlib import Path from collections import defaultdict import pandas as pd ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/vad/__init__.py
examples/speech_synthesis/preprocessing/vad/__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 collections import contextlib import wave try: import webrtcvad except ImportError: raise ImportError("Please install py-webr...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/speaker_embedder/__init__.py
examples/speech_synthesis/preprocessing/speaker_embedder/__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 librosa import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torchaudio EMBEDDER_PARAMS...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoiser/pretrained.py
examples/speech_synthesis/preprocessing/denoiser/pretrained.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # author: adefossez import logging import torch.hub from .demucs import Demucs from .utils import deserialize_model logg...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoiser/demucs.py
examples/speech_synthesis/preprocessing/denoiser/demucs.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # author: adefossez import math import time import torch as th from torch import nn from torch.nn import functional as F ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoiser/utils.py
examples/speech_synthesis/preprocessing/denoiser/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # author: adefossez import functools import logging from contextlib import contextmanager import inspect import time logge...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoiser/__init__.py
examples/speech_synthesis/preprocessing/denoiser/__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.
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/preprocessing/denoiser/resample.py
examples/speech_synthesis/preprocessing/denoiser/resample.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # author: adefossez import math import torch as th from torch.nn import functional as F def sinc(t): """sinc. :...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/evaluation/get_eval_manifest.py
examples/speech_synthesis/evaluation/get_eval_manifest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import csv from pathlib import Path def main(args): """ `uid syn ref text` """ in_root = Path(args.generation_root).resolve...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/evaluation/eval_asr.py
examples/speech_synthesis/evaluation/eval_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 argparse import editdistance import re import shutil import soundfile as sf import subprocess from pathlib import Path from examples.s...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/evaluation/eval_sp.py
examples/speech_synthesis/evaluation/eval_sp.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Signal processing-based evaluation using waveforms """ import csv import numpy as np import os.path as op import torch import tqdm from...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/evaluation/eval_f0.py
examples/speech_synthesis/evaluation/eval_f0.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Signal processing-based evaluation using waveforms """ import numpy as np import os.path as op import torchaudio import tqdm from tabulat...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_synthesis/evaluation/__init__.py
examples/speech_synthesis/evaluation/__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.
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_generate.py
examples/noisychannel/rerank_generate.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. """ Generate n-best translations using a trained model. """ import os import subprocess from contextlib import redi...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_score_lm.py
examples/noisychannel/rerank_score_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 os from fairseq import options from examples.noisychannel import rerank_options, rerank_utils def score_lm(args): using_nbest =...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_score_bw.py
examples/noisychannel/rerank_score_bw.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from contextlib import redirect_stdout from fairseq import options from fairseq_cli import generate from examples.noisychannel imp...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_utils.py
examples/noisychannel/rerank_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import os import re import subprocess from contextlib import redirect_stdout from fairseq import options from fairseq_cli import ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank.py
examples/noisychannel/rerank.py
# Copyright (c) Facebook, Inc. and its 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 multiprocessing import Pool import numpy as np from fairseq import options from fairseq.data import dictionary from fairseq....
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_options.py
examples/noisychannel/rerank_options.py
# Copyright (c) Facebook, Inc. and 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 options def get_reranking_parser(default_task="translation"): parser = options.get_parser("Generation and reranking"...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/__init__.py
examples/noisychannel/__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 .rerank_options import * # noqa
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/noisychannel/rerank_tune.py
examples/noisychannel/rerank_tune.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import random import numpy as np from fairseq import options from examples.noisychannel import rerank, rerank_options def ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/audio_nlp/nlu/generate_manifests.py
examples/audio_nlp/nlu/generate_manifests.py
import argparse from pathlib import Path import soundfile def get_insl_frame(parse): out = [] def is_ont_token(tok): return tok[0] in ["[", "]"]; res = [] x = [] for tok in parse.split(): if is_ont_token(tok): res.extend('_'.join(x)) x = [] res.a...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/__init__.py
examples/linformer/linformer_src/__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 .models import linformer_roberta # noqa
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/models/linformer_roberta.py
examples/linformer/linformer_src/models/linformer_roberta.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Linformer: Self-Attention with Linear Complexity """ import logging import torch from fairseq import utils from fairseq.models import reg...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/models/__init__.py
examples/linformer/linformer_src/models/__init__.py
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/modules/linformer_sentence_encoder.py
examples/linformer/linformer_src/modules/linformer_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 math import torch.nn as nn from fairseq.models.transformer import TransformerEncoder from .linformer_sentence_encoder_layer import Li...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/modules/__init__.py
examples/linformer/linformer_src/modules/__init__.py
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/modules/multihead_linear_attention.py
examples/linformer/linformer_src/modules/multihead_linear_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 from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from fairseq import utils from fairseq.incr...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py
examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq import utils from fairseq.modules import TransformerEncoderLayer from .multihead_linear_attention import MultiheadL...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/process_data/remove_too_much_punc.py
examples/m2m_100/process_data/remove_too_much_punc.py
import gzip import argparse from string import punctuation def len_no_punc(s, punc): return len([ch for ch in s if ch in punc]) def filter_overpunc(len_npunc, len_sen): return len_npunc < 0.5*len_sen def main(args): punc = punctuation + "—|–" print('Processing file {}'.format(args.input)) with gz...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/process_data/clean_histogram.py
examples/m2m_100/process_data/clean_histogram.py
import argparse parser = argparse.ArgumentParser() parser.add_argument('--src', type=str, help='Source language') parser.add_argument('--tgt', type=str, help='Target language') parser.add_argument('--src-file', type=str, help='Input source file') parser.add_argument('--tgt-file', type=str, help='Input target file') pa...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/process_data/dedup_data.py
examples/m2m_100/process_data/dedup_data.py
import argparse from collections import namedtuple import os DATADIR = "/path/to/train_data" DEDUP_FROM_DIR = "/path/to/eval/data" OUTPUT_DIR = "/path/to/output/data" def main(args): languages = set() for language_directory in os.listdir(DATADIR): if "_" in language_directory: src, tgt = ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/tokenizers/tokenize_indic.py
examples/m2m_100/tokenizers/tokenize_indic.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Use: echo {text} | python tokenize_indic.py {language} import sys from indicnlp.normalize.indic_normalize import In...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/tokenizers/tokenize_thai.py
examples/m2m_100/tokenizers/tokenize_thai.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys from pythainlp import word_tokenize for line in sys.stdin: print(" ".join(word_tokenize(line.strip())...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/m2m_100/tokenizers/tokenize_zh.py
examples/m2m_100/tokenizers/tokenize_zh.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import fileinput import sacrebleu for line in fileinput.input(): print(sacrebleu.tokenize_zh(line))
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/bart/summarize.py
examples/bart/summarize.py
# Copyright (c) Facebook, Inc. and its 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.bart import BARTModel import argparse XSUM_KWARGS = dict(beam=6, lenpen=1.0, max_len_b=60, min_len=10, no_re...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/data_utils.py
examples/speech_to_text/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import csv from pathlib import Path import zipfile from functools import reduce from multiprocessing import cpu_count from typing import Any, ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/prep_mtedx_data.py
examples/speech_to_text/prep_mtedx_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/prep_librispeech_data.py
examples/speech_to_text/prep_librispeech_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile import p...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/seg_mustc_data.py
examples/speech_to_text/seg_mustc_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import soundfile as sf from examples.speech_to_text.prep_mustc_...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/prep_mustc_data.py
examples/speech_to_text/prep_mustc_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/prep_covost_data.py
examples/speech_to_text/prep_covost_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile from typi...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py
examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py
import math import os import json import numpy as np import torch import torchaudio.compliance.kaldi as kaldi import yaml from fairseq import checkpoint_utils, tasks from fairseq.file_io import PathManager try: from simuleval import READ_ACTION, WRITE_ACTION, DEFAULT_EOS from simuleval.agents import SpeechAgen...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/__init__.py
examples/speech_text_joint_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 . import tasks, criterions, models # noqa
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/scripts/convert_model.py
examples/speech_text_joint_to_text/scripts/convert_model.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import re from collections import OrderedDict import torch from fairseq.file_io import PathManager ...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/scripts/g2p_encode.py
examples/speech_text_joint_to_text/scripts/g2p_encode.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import itertools import logging import re import time from g2p_en import G2p logger = logging.getLogger(__name__) FAIL_SENT...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/tasks/speech_text_joint.py
examples/speech_text_joint_to_text/tasks/speech_text_joint.py
# Copyright (c) Facebook, Inc. and its 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 from argparse import Namespace from pathlib import Path import torch from fairseq.data import ( encoders, Dic...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/tasks/speech_text_denoise_pretrain.py
examples/speech_text_joint_to_text/tasks/speech_text_denoise_pretrain.py
# Copyright (c) Facebook, Inc. and its 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 re from argparse import Namespace from pathlib import Path from fairseq.data import ConcatDataset, Dictionary,...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/tasks/pair_denoising.py
examples/speech_text_joint_to_text/tasks/pair_denoising.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import itertools import logging import os import re import numpy as np import torch from examples.speech_text_joint_to_text.data.pair_denois...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/tasks/__init__.py
examples/speech_text_joint_to_text/tasks/__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
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/models/joint_speech_text_pretrain_transformer.py
examples/speech_text_joint_to_text/models/joint_speech_text_pretrain_transformer.py
#!/usr/bin/env python3 import logging from collections import OrderedDict, namedtuple from typing import Dict, Optional import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from fairseq import checkpoint_utils, utils from fairseq.file_io import PathManager from fairseq.models i...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/models/s2t_dualinputwavtransformer.py
examples/speech_text_joint_to_text/models/s2t_dualinputwavtransformer.py
# Copyright (c) Facebook, Inc. and its 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 OrderedDict, namedtuple import torch.nn as nn from fairseq import checkpoint_utils, utils from fairse...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/models/s2t_dualinputxmtransformer.py
examples/speech_text_joint_to_text/models/s2t_dualinputxmtransformer.py
# Copyright (c) Facebook, Inc. and its 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 torch.nn as nn from fairseq import checkpoint_utils from fairseq import utils from fairseq.data.data_utils import lengths_...
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false
facebookresearch/fairseq
https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/speech_text_joint_to_text/models/__init__.py
examples/speech_text_joint_to_text/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 importlib import os
python
MIT
3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99
2026-01-04T14:42:59.188867Z
false