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/MMPT/mmpt/modules/__init__.py | examples/MMPT/mmpt/modules/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .mm import *
try:
from .expmm import *
except ImportError:
pass
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/evaluators/predictor.py | examples/MMPT/mmpt/evaluators/predictor.py | # Copyright (c) Facebook, Inc. and 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 random
import json
import numpy as np
import torch
import pickle
import math
from tqdm import tqdm
class Predictor(object):... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/evaluators/evaluator.py | examples/MMPT/mmpt/evaluators/evaluator.py | # Copyright (c) Facebook, Inc. and 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 glob
import numpy as np
from . import metric as metric_path
from . import predictor as predictor_path
class Evaluator(objec... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/evaluators/__init__.py | examples/MMPT/mmpt/evaluators/__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 .metric import *
from .evaluator import *
# experimental.
try:
from .expmetric import *
except ImportError:
pass
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/evaluators/metric.py | examples/MMPT/mmpt/evaluators/metric.py | # Copyright (c) Facebook, Inc. and 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 json
class Metric(object):
def __init__(self, config, metric_names):
self.metric_names = metric_names
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/dedupprocessor.py | examples/MMPT/mmpt/processors/dedupprocessor.py | # Copyright (c) Facebook, Inc. and 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 random
import json
import pickle
from tqdm import tqdm
import os
import numpy as np
class CaptionDedupProcessor(object):
"""remov... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/processor.py | examples/MMPT/mmpt/processors/processor.py | # Copyright (c) Facebook, Inc. All Rights Reserved
import numpy as np
import os
import torch
class Processor(object):
"""
A generic processor for video (codec, feature etc.) and text.
"""
def __call__(self, **kwargs):
raise NotImplementedError
class MetaProcessor(Processor):
"""
A ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/how2retriprocessor.py | examples/MMPT/mmpt/processors/how2retriprocessor.py | # Copyright (c) Facebook, Inc. and 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 .how2processor import (
ShardedHow2MetaProcessor,
ShardedVideoProcessor,
ShardedTextProcessor,
VariedLenAligner,
Over... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/__init__.py | examples/MMPT/mmpt/processors/__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 .processor import *
from .how2processor import *
from .how2retriprocessor import *
from .dsprocessor import *
try:
from .rawvideopr... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/how2processor.py | examples/MMPT/mmpt/processors/how2processor.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/dsprocessor.py | examples/MMPT/mmpt/processors/dsprocessor.py | # Copyright (c) Facebook, Inc. All Rights Reserved
"""
Processors for all downstream (ds) tasks.
"""
import json
import os
import pickle
import random
import math
import numpy as np
import torch
from collections import defaultdict
from .processor import (
MetaProcessor,
VideoProcessor,
TextProcessor,
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt/processors/models/s3dg.py | examples/MMPT/mmpt/processors/models/s3dg.py | # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Contains a PyTorch definition for Gated Separable 3D network (S3D-G)
with a text module for computing joint text-video embedding from raw text
and video input. The following code will enable y... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt_cli/localjob.py | examples/MMPT/mmpt_cli/localjob.py | # Copyright (c) Facebook, Inc. and 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 mmpt.utils import recursive_config
class BaseJob(object):
def __init__(self, yaml_file, dryrun=False):
self.yaml_... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/MMPT/mmpt_cli/predict.py | examples/MMPT/mmpt_cli/predict.py | # Copyright (c) Facebook, Inc. and 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 glob
import argparse
import pprint
import omegaconf
from omegaconf import OmegaConf
from torch.utils.data import DataLoader
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/misc/get_sample_size.py | examples/mms/misc/get_sample_size.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.
"""
Usage:
$ python misc/get_sample_size.py <input_file> > <output_file>
<input_file> contains list of w... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/data_prep/align_utils.py | examples/mms/data_prep/align_utils.py | import re
import os
import torch
import tempfile
import math
from dataclasses import dataclass
from torchaudio.models import wav2vec2_model
# iso codes with specialized rules in uroman
special_isos_uroman = "ara, bel, bul, deu, ell, eng, fas, grc, ell, eng, heb, kaz, kir, lav, lit, mkd, mkd2, oss, pnt, pus, rus, srp,... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/data_prep/norm_config.py | examples/mms/data_prep/norm_config.py | import os
import re
colon = ":"
comma = ","
exclamation_mark = "!"
period = re.escape(".")
question_mark = re.escape("?")
semicolon = ";"
left_curly_bracket = "{"
right_curly_bracket = "}"
quotation_mark = '"'
basic_punc = (
period
+ question_mark
+ comma
+ colon
+ exclamation_mark
+ left_cu... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/data_prep/align_and_segment.py | examples/mms/data_prep/align_and_segment.py | import os
import torch
import torchaudio
import sox
import json
import argparse
from examples.mms.data_prep.text_normalization import text_normalize
from examples.mms.data_prep.align_utils import (
get_uroman_tokens,
time_to_frame,
load_model_dict,
merge_repeats,
get_spans,
)
import torchaudio.fun... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/data_prep/text_normalization.py | examples/mms/data_prep/text_normalization.py | import json
import re
import unicodedata
from examples.mms.data_prep.norm_config import norm_config
def text_normalize(text, iso_code, lower_case=True, remove_numbers=True, remove_brackets=False):
"""Given a text, normalize it by changing to lower case, removing punctuations, removing words that only contain di... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid/infer.py | examples/mms/lid/infer.py | import torch
from fairseq.data.text_compressor import TextCompressionLevel, TextCompressor
from fairseq import checkpoint_utils, distributed_utils, options, utils
from fairseq import checkpoint_utils, data, options, tasks
from fairseq.data import FileAudioDataset, AddTargetDataset, Dictionary
from fairseq.tasks.audio_c... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/asr/infer/mms_infer.py | examples/mms/asr/infer/mms_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 argparse
import soundfile as sf
import tempfile
from pathlib import Path
import os
import subprocess
import sy... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms-zs/lib.py | examples/mms/lid_rerank/mms-zs/lib.py | import os
from dataclasses import dataclass
import torch
import torch.utils.cpp_extension
cuda_source = """
#include <ATen/core/TensorAccessor.h>
#include <ATen/cuda/CUDAContext.h>
#include <torch/extension.h>
#include <vector>
#include <limits.h>
#include <cub/cub.cuh>
#include <iostream>
using namespace torch::ind... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms-zs/falign.py | examples/mms/lid_rerank/mms-zs/falign.py | import os
import tempfile
import re
import librosa
import torch
import json
import numpy as np
import argparse
from tqdm import tqdm
import math
from transformers import Wav2Vec2ForCTC, AutoProcessor
from lib import falign_ext
parser = argparse.ArgumentParser()
parser.add_argument("--uroman_txt", type=str)
parser.ad... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms-zs/uromanize.py | examples/mms/lid_rerank/mms-zs/uromanize.py | import os
import tempfile
import re
import argparse
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("--txt", type=str)
parser.add_argument("--lid", type=str)
parser.add_argument("--dst", type=str)
parser.add_argument("--model", type=str)
args = parser.parse_args()
UROMAN_PL = args.model +... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mala/infer.py | examples/mms/lid_rerank/mala/infer.py | from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
from tqdm import tqdm
import argparse
import os
import torch
parser = argparse.ArgumentParser()
parser.add_argument("--txt", type=str)
parser.add_argument("--dst", type=str)
parser.add_argument("--gpu", type=int, default=1)
args = ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/rerank/tune_coefficients.py | examples/mms/lid_rerank/rerank/tune_coefficients.py | import argparse
import os
from tqdm import tqdm
import numpy as np
import editdistance
from multiprocessing import Pool
from functools import partial
cer_langs = [x.strip() for x in open("cer_langs.txt", "r").readlines()]
def compute(w, feats, ref_lid, nbest_lid, ref_asr, nbest_asr, n=10, exclude=None):
assert le... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/rerank/rerank.py | examples/mms/lid_rerank/rerank/rerank.py | import argparse
import json
from collections import defaultdict
import os
from tqdm import tqdm
import sys
import subprocess
import re
import math
import numpy as np
import editdistance
from sklearn.preprocessing import StandardScaler
from multiprocessing import Pool
from functools import partial
import random
cer_lan... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms/merge_by_lang.py | examples/mms/lid_rerank/mms/merge_by_lang.py | import argparse
import json
from collections import defaultdict
import os
import soundfile as sf
from tqdm import tqdm
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Example argument parser')
parser.add_argument('--exp', type=str)
parser.add_argument('--dump', type=str)
args =... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms/split_by_lang.py | examples/mms/lid_rerank/mms/split_by_lang.py | import argparse
import json
from collections import defaultdict
import os
import soundfile as sf
from tqdm import tqdm
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Example argument parser')
parser.add_argument('--wavs_tsv', type=str)
parser.add_argument('--lid_preds', type=str)
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms/prep_wav_list.py | examples/mms/lid_rerank/mms/prep_wav_list.py | import soundfile as sf
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Example argument parser')
parser.add_argument('--src', type=str)
parser.add_argument('--dst', type=str)
args = parser.parse_args()
wavs = [x.strip() for x in open(args.src, "r").readline... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms/make_parallel_single_runs.py | examples/mms/lid_rerank/mms/make_parallel_single_runs.py | import argparse
import json
from collections import defaultdict
import os
from tqdm import tqdm
import sys
import subprocess
import re
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Example argument parser')
parser.add_argument('--dump', type=str)
parser.add_argument('--model', ty... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/mms/run_single_lang.py | examples/mms/lid_rerank/mms/run_single_lang.py | import argparse
import json
from collections import defaultdict
import os
from tqdm import tqdm
import sys
import subprocess
import re
mapping = {"cmn":"cmn-script_simplified", "srp":"srp-script_latin", "urd":"urd-script_arabic", "uzb":"uzb-script_latin", "yue":"yue-script_traditional", "aze":"azj-script_latin", "kmr"... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/nllb/infer.py | examples/mms/lid_rerank/nllb/infer.py | #!/usr/bin/env python3
# -*- encoding: utf8 -*-
import fasttext
from tqdm import tqdm
import argparse
import os
import math
parser = argparse.ArgumentParser()
parser.add_argument("--txt", type=str)
parser.add_argument("--dst", type=str)
parser.add_argument("--model", type=str)
parser.add_argument('--lid', type=str)
ar... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/whisper/infer_lid.py | examples/mms/lid_rerank/whisper/infer_lid.py | #!/usr/bin/env python3
# -*- encoding: utf8 -*-
import argparse
import itertools
import os
import re
import sys
from pathlib import Path
import math
import whisper
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("--wavs", type=str)
parser.add_argument("--dst", type=str)
parser.add_argum... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/lid_rerank/whisper/infer_asr.py | examples/mms/lid_rerank/whisper/infer_asr.py | #!/usr/bin/env python3
# -*- encoding: utf8 -*-
import argparse
import itertools
import os
import re
import sys
from pathlib import Path
import whisper
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("--wavs", type=str)
parser.add_argument("--lids", type=str)
parser.add_argument("--dst"... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/mms/tts/infer.py | examples/mms/tts/infer.py | # Copyright (c) Facebook, Inc. and 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 re
import glob
import json
import tempfile
import math
import torch
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/megatron_11b/detok.py | examples/megatron_11b/detok.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import fileinput
import sacremoses
def main():
parser = argparse.ArgumentParser(description="... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/womens_bios/query_occupations_from_wikidata.py | examples/womens_bios/query_occupations_from_wikidata.py | import sys
from SPARQLWrapper import SPARQLWrapper, JSON
endpoint_url = "https://query.wikidata.org/sparql"
with open("/your/urls/here") as f:
data = f.readlines()
urls = [i.strip() for i in data]
def get_results(endpoint_url, URL):
query = f"""SELECT ?uriLabel ?occupation ?occupationLabel ?dob ?dobLabel WHE... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/adagrad_with_grad_clip.py | examples/adaptive_span/adagrad_with_grad_clip.py | # Copyright (c) Facebook, Inc. and 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.optim import Adagrad
from fairseq.optim import LegacyFairseqOptimizer, register_optimizer
@register_optimizer("adagrad_with_grad... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/adaptive_span_loss.py | examples/adaptive_span/adaptive_span_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/examples/adaptive_span/adaptive_span_attention.py | examples/adaptive_span/adaptive_span_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
import torch.nn as nn
import torch.nn.functional as F
class AdaptiveMask(nn.Module):
"""Soft masking function f... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/adaptive_span_model.py | examples/adaptive_span/adaptive_span_model.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.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.modules.layer_norm import Lay... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/__init__.py | examples/adaptive_span/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
# automatically import any Python files in the current directory
cur_dir = os.path.dirname(__file__)
for file in o... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/adaptive_span_model_wrapper.py | examples/adaptive_span/adaptive_span_model_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
from dataclasses import dataclass
from typing import Dict, List, Optional
import torch
from fairseq.dataclass import FairseqDa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/adaptive_span/truncated_bptt_lm_task.py | examples/adaptive_span/truncated_bptt_lm_task.py | # Copyright (c) Facebook, Inc. and 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 dataclasses import dataclass, field
from typing import List, Optional, Tuple
import torch
from fairseq import u... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/__init__.py | examples/discriminative_reranking_nmt/__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/discriminative_reranking_nmt/drnmt_rerank.py | examples/discriminative_reranking_nmt/drnmt_rerank.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.
"""
Score raw text with a trained model.
"""
from collections import namedtuple
import logging
from multiprocessing ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/scripts/prep_data.py | examples/discriminative_reranking_nmt/scripts/prep_data.py | #!/usr/bin/env python
import argparse
from multiprocessing import Pool
from pathlib import Path
import sacrebleu
import sentencepiece as spm
def read_text_file(filename):
with open(filename, "r") as f:
output = [line.strip() for line in f]
return output
def get_bleu(in_sent, target_sent):
ble... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/tasks/discriminative_reranking_task.py | examples/discriminative_reranking_nmt/tasks/discriminative_reranking_task.py | # Copyright (c) Facebook, Inc. and 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 itertools
import logging
import os
import numpy as np
import torch
from fairseq.logging imp... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/tasks/__init__.py | examples/discriminative_reranking_nmt/tasks/__init__.py | from .discriminative_reranking_task import DiscriminativeRerankingNMTTask
__all__ = [
"DiscriminativeRerankingNMTTask",
]
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/models/discriminative_reranking_model.py | examples/discriminative_reranking_nmt/models/discriminative_reranking_model.py | from dataclasses import dataclass, field
import os
import torch
import torch.nn as nn
from fairseq import utils
from fairseq.dataclass import ChoiceEnum, FairseqDataclass
from fairseq.models import (
BaseFairseqModel,
register_model,
)
from fairseq.models.roberta.model import RobertaClassificationHead
from ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/models/__init__.py | examples/discriminative_reranking_nmt/models/__init__.py | from .discriminative_reranking_model import DiscriminativeNMTReranker
__all__ = [
"DiscriminativeNMTReranker",
]
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/criterions/__init__.py | examples/discriminative_reranking_nmt/criterions/__init__.py | from .discriminative_reranking_criterion import KLDivergenceRerankingCriterion
__all__ = [
"KLDivergenceRerankingCriterion",
]
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/discriminative_reranking_nmt/criterions/discriminative_reranking_criterion.py | examples/discriminative_reranking_nmt/criterions/discriminative_reranking_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
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/examples/wav2vec/wav2vec_featurize.py | examples/wav2vec/wav2vec_featurize.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.
"""
Helper script to pre-compute embeddings for a flashlight (previously called wav2letter++) dataset
"""
import argpa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/vq-wav2vec_featurize.py | examples/wav2vec/vq-wav2vec_featurize.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.
"""
Helper script to pre-compute embeddings for a flashlight (previously called wav2letter++) dataset
"""
import argpa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/__init__.py | examples/wav2vec/__init__.py | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false | |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/wav2vec_manifest.py | examples/wav2vec/wav2vec_manifest.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.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
import argparse
import glob
import os
impor... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/libri_labels.py | examples/wav2vec/libri_labels.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.
"""
Helper script to pre-compute embeddings for a flashlight (previously called wav2letter++) dataset
"""
import argpa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/xlsr/scripts/eval_speaker_clf_task.py | examples/wav2vec/xlsr/scripts/eval_speaker_clf_task.py | """
Usage:
This scripts it to evaluate the classification accuracy/error rate from the embedding extracted
by gen_audio_embedding.py
Example (LID classification)
PYTHONPATH='.' python examples/wav2vec/eval_speaker_clf_task.py \
--data /fsx/androstj/exps/lid_voxlingua/infer/atj_xlsr2_100pct... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/xlsr/scripts/gen_audio_embedding.py | examples/wav2vec/xlsr/scripts/gen_audio_embedding.py | """
Usage:
This script is used to extract the embedding / logit for speech classification task.
1. Set fdir into your model checkpoint directory
2. Run the following command (preferrably on GPU machine to speed up the inference process)
CUDA_VISIBLE_DEVICES=0 python3 examples/wav2vec/gen_audio_embeddin... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/w2vu_generate.py | examples/wav2vec/unsupervised/w2vu_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.
"""
Run inference for pre-processed data with a trained model.
"""
import ast
from collections import namedtuple
fr... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/__init__.py | examples/wav2vec/unsupervised/__init__.py | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false | |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py | examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.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 fasttext as ft
import os
import regex
import sys
def get_parser():
parser = argparse.Argum... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/ltr_to_wrd.py | examples/wav2vec/unsupervised/scripts/ltr_to_wrd.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
def main():
for line in sys.stdin:
print(line.replace(" ", "").replace("|", " ").strip())
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/mean_pool.py | examples/wav2vec/unsupervised/scripts/mean_pool.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import math
import numpy as np
import tqdm
import torch
import torch... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/copy_labels.py | examples/wav2vec/unsupervised/scripts/copy_labels.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
for idx, line in enumerate(sys.stdin):
print(f"utt{idx:010d} {line}", end="")
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/g2p_wrd_to_phn.py | examples/wav2vec/unsupervised/scripts/g2p_wrd_to_phn.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import sys
from g2p_en import G2p
def main():
parser = argparse.ArgumentParser()
parser.a... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/wav2vec_extract_features.py | examples/wav2vec/unsupervised/scripts/wav2vec_extract_features.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import tqdm
import torch
import torch.nn.functional as F
from shutil... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/filter_tsv.py | examples/wav2vec/unsupervised/scripts/filter_tsv.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("--tsv", required=True... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/wav2vec_cluster_faiss.py | examples/wav2vec/unsupervised/scripts/wav2vec_cluster_faiss.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import gc
import os
import os.path as osp
import random
import numpy as np
import tqdm
import torch
... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/merge_clusters.py | examples/wav2vec/unsupervised/scripts/merge_clusters.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import numpy as np
import tqdm
import torch
import random
from shuti... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/phonemize_with_sil.py | examples/wav2vec/unsupervised/scripts/phonemize_with_sil.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import numpy as np
import sys
def get_parser():
parser = argparse.ArgumentParser(
desc... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/normalize_text.py | examples/wav2vec/unsupervised/scripts/normalize_text.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 regex
import sys
def main():
filter_r = regex.compile(r"[^\p{L}\p{N}\p{M}\' \-]")
for line in sys.std... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/wrd_to_ltr.py | examples/wav2vec/unsupervised/scripts/wrd_to_ltr.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
def main():
for line in sys.stdin:
print(" ".join(list(line.strip().replace(" ", "|"))) + "... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/filter_lexicon.py | examples/wav2vec/unsupervised/scripts/filter_lexicon.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import sys
from fairseq.data import Dictionary
def get_parser():
parser = argparse.ArgumentPa... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/apply_pca.py | examples/wav2vec/unsupervised/scripts/apply_pca.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import math
import numpy as np
import tqdm
import torch
from shutil ... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/wer.py | examples/wav2vec/unsupervised/scripts/wer.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.
"""
Implement unsupervised metric for decoding hyperparameter selection:
$$ alpha * LM_PPL + ViterbitUER(%) * 10... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/remove_silence.py | examples/wav2vec/unsupervised/scripts/remove_silence.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.
"""
get intervals from .vads file, specify output data, and this script removes silences and saves the audio data in... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/vads.py | examples/wav2vec/unsupervised/scripts/vads.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import sys
from copy import deepcopy
from scipy.signal import lfilter
import numpy as np
from tqdm... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/pca.py | examples/wav2vec/unsupervised/scripts/pca.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import numpy as np
import faiss
def get_parser():
parser = a... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/scripts/wav2vec_apply_cluster_faiss.py | examples/wav2vec/unsupervised/scripts/wav2vec_apply_cluster_faiss.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import os.path as osp
import numpy as np
import tqdm
import torch
import sys
import faiss... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/tasks/unpaired_audio_text.py | examples/wav2vec/unsupervised/tasks/unpaired_audio_text.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 dataclasses import dataclass,... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/tasks/__init__.py | examples/wav2vec/unsupervised/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.
from .unpaired_audio_text import UnpairedAudioText
__all__ = [
"UnpairedAudioText",
]
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/models/wav2vec_u.py | examples/wav2vec/unsupervised/models/wav2vec_u.py | # Copyright (c) Facebook, Inc. and 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 enum import Enum, auto
import math
import numpy as np
from typing import Tuple, List, Optional, Dict
i... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/models/__init__.py | examples/wav2vec/unsupervised/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.
from .wav2vec_u import Wav2vec_U
__all__ = [
"Wav2vec_U",
]
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/data/__init__.py | examples/wav2vec/unsupervised/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 .extracted_features_dataset import ExtractedFeaturesDataset
from .random_input_dataset import RandomInputDataset
__all__ = [
"Extra... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/data/extracted_features_dataset.py | examples/wav2vec/unsupervised/data/extracted_features_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 logging
import os
import contextlib
import numpy as np
import torch
from fairseq.data import FairseqDataset, data_utils
logger = l... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/data/random_input_dataset.py | examples/wav2vec/unsupervised/data/random_input_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 random
from typing import List
from fairseq.data import BaseWrapperDataset, data_utils
class RandomInputDataset(BaseWrapperDataset):... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/kaldi_self_train/st/local/copy_aligned_text.py | examples/wav2vec/unsupervised/kaldi_self_train/st/local/copy_aligned_text.py | import sys
for idx, line in enumerate(sys.stdin):
print(f"utt{idx:010d} {line}", end='') | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select.py | examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select.py | """
Implement unsupervised metric for decoding hyperparameter selection:
$$ alpha * LM_PPL + ViterbitUER(%) * 100 $$
"""
import argparse
import logging
import math
import sys
import kenlm
import editdistance
from g2p_en import G2p
logging.root.setLevel(logging.INFO)
logging.basicConfig(stream=sys.stdout, level=lo... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/wav2vec/unsupervised/kaldi_self_train/st/local/prepare_data_from_w2v.py | examples/wav2vec/unsupervised/kaldi_self_train/st/local/prepare_data_from_w2v.py | import kaldi_io
import numpy as np
import os
def get_parser():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("w2v_dir", help="wav2vec feature and text directory")
parser.add_argument("tar_root", help="output data directory in kaldi's format")
parser.add_argument("split", h... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/xmod/preprocess_nli.py | examples/xmod/preprocess_nli.py | # Copyright (c) Facebook, Inc. and 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 json
import collections
import argparse
import shutil
import subprocess
import sys
import tempfile
from multiprocessing impor... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/laser/laser_src/laser_transformer.py | examples/laser/laser_src/laser_transformer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Any, Dict, List, Optional
from torch import Tensor
import torch
import torch.nn as nn
from fairseq.models... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/laser/laser_src/__init__.py | examples/laser/laser_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 .laser_task import * # noqa
from .laser_lstm import * # noqa
from .laser_transformer import * # noqa
| python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/laser/laser_src/laser_task.py | examples/laser/laser_src/laser_task.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict, defaultdict
import json
import os
import logging
from argparse import ArgumentError
from fairseq import... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/laser/laser_src/multitask_data_utils.py | examples/laser/laser_src/multitask_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.
from collections import OrderedDict
import numpy as np
from fairseq.data import BaseWrapperDataset, FairseqDataset, iterators
class MultiI... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | false |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/laser/laser_src/laser_lstm.py | examples/laser/laser_src/laser_lstm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import options, utils
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/fast_noisy_channel/noisy_channel_sequence_generator.py | examples/fast_noisy_channel/noisy_channel_sequence_generator.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Optional
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor... | python | MIT | 3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99 | 2026-01-04T14:42:59.188867Z | true |
facebookresearch/fairseq | https://github.com/facebookresearch/fairseq/blob/3d262bb25690e4eb2e7d3c1309b1e9c406ca4b99/examples/fast_noisy_channel/noisy_channel_translation.py | examples/fast_noisy_channel/noisy_channel_translation.py | # Copyright (c) Facebook, Inc. and 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.tasks.translation import TranslationTask
from fairseq.tasks.language_modeling import LanguageModelingTask
from fairseq import che... | 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.