python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Clockwork-main
planner/__init__.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 annotations import logging import sys from common.data_types import UnixtimeAssignments __AL...
Clockwork-main
planner/plan_writer.py
#!/usr/bin/env python3 # pyre-strict # Copyright (c) Facebook, Inc. and 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 annotations import asyncio from abc import ABC from typing import FrozenSet impor...
Clockwork-main
algorithm/algorithm.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 annotations from abc import ABC from typing import FrozenSet from common.data_types import Tas...
Clockwork-main
algorithm/task_fetchers.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Clockwork-main
algorithm/__init__.py
#!/usr/bin/env python3 # pyre-strict # Copyright (c) Facebook, Inc. and 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 annotations from typing import Dict import logging import sys from common.data_t...
Clockwork-main
algorithm/right_based/algorithm.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 annotations from dataclasses import dataclass, field from typing import Dict, FrozenSet, List, ...
Clockwork-main
algorithm/right_based/metadata.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Clockwork-main
algorithm/right_based/__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.
Clockwork-main
algorithm/tests/__init__.py
#!/usr/bin/env python3 # pyre-strict # Copyright (c) Facebook, Inc. and 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 annotations import unittest from algorithm.right_based.algorithm import schedule...
Clockwork-main
algorithm/tests/test_right_based.py
#!/usr/bin/self.env python3 # pyre-strict # pyre-ignore-all-errors[29] # Copyright (c) Facebook, Inc. and 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 annotations from enum import Enum from datetime...
Clockwork-main
common/time_interval.py
#!/usr/bin/self.env python3 # pyre-strict # pyre-ignore-all-errors[29] # Copyright (c) Facebook, Inc. and 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 annotations from enum import Enum from typing i...
Clockwork-main
common/memory.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 operator from dataclasses import dataclass from typing import Callable, Dict, Generator, List from common.time_...
Clockwork-main
common/skyline_math.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Clockwork-main
common/__init__.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 annotations from dataclasses import dataclass from typing import Dict, FrozenSet from common.t...
Clockwork-main
common/data_types.py
#!/usr/bin/env python3 # pyre-strict # Copyright (c) Facebook, Inc. and 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 annotations import datetime import time from typing import Any, overload import s...
Clockwork-main
common/timestamp.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 os import subprocess import sys from setuptools import setup, find_packages, Extension from setuptools import E...
bart_ls-main
fairseq-py/setup.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. """ Legacy entry point. Use fairseq_cli/train.py or fairseq-train instead. """ from fairseq_cli.train import cli_mai...
bart_ls-main
fairseq-py/train.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """isort:skip_file""" import functools import importlib dependencies = [ "dataclasses", "hydra", "numpy", "omegaconf", "...
bart_ls-main
fairseq-py/hubconf.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/sweep_model_denoising_easy_...
bart_ls-main
fairseq-py/fb_sweep/sweep_model_denoising_easy_mask.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python """ Usage: ./fb_sweep/sweep_lm_wikitext103_transformer_xl.py \ -d ~myleott/data/data-bin/wikitext-103/ \ -p wt...
bart_ls-main
fairseq-py/fb_sweep/sweep_lm_wikitext103_transformer_xl.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python """ Usage: ./fb_sweep/apdative_span_sweep.py\ -d ~daju/data/enwik8/eos-data-bin/ \ -p enwiki8.adaptivespan ...
bart_ls-main
fairseq-py/fb_sweep/sweep_adaptive_span.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): grid = [] total_num_udpates = 20000 warmu...
bart_ls-main
fairseq-py/fb_sweep/sweep_bart_cnn.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): grid = [] total_num_udpates = 50000 max_e...
bart_ls-main
fairseq-py/fb_sweep/sweep_ami_icsi.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam def get_grid(args): max_update = 300000 ef...
bart_ls-main
fairseq-py/fb_sweep/sweep_megatron_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. #!/usr/bin/env python import sweep from sweep import hyperparam from sweep_wmt_en2de_transformer_big_common import get_common_grid COMMON_...
bart_ls-main
fairseq-py/fb_sweep/sweep_wmt_en2de_transformer_big_ddp.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): max_update = 100000 return [ hyperpa...
bart_ls-main
fairseq-py/fb_sweep/sweep_gpt2_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 unittest from agg_results import make_sweep_table, find_common_prefix class TestAggResults(unittest.TestCase): def test_make_swe...
bart_ls-main
fairseq-py/fb_sweep/test_agg_results.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): return [ hyperparam("--train-subset", "tra...
bart_ls-main
fairseq-py/fb_sweep/sweep_dummy_lm.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and 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 sweep from sweep import hyperparam PREDIFINED_GRID_FUNCTION = {} def register_grid(name): def register_gr...
bart_ls-main
fairseq-py/fb_sweep/sweep_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. #!/usr/bin/env python from itertools import takewhile from glob import glob import json from pathlib import Path import re from typing import...
bart_ls-main
fairseq-py/fb_sweep/agg_results.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam MODEL = { "levenshtein_transformer": "lev_base", "levenshtein_trans...
bart_ls-main
fairseq-py/fb_sweep/sweep_nonautoregressive_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. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam def get_grid(args): grid = [] total_num_ud...
bart_ls-main
fairseq-py/fb_sweep/sweep_bart_large.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam from sweep_wmt_en2de_transformer_big_common import get_common_grid COMMON_...
bart_ls-main
fairseq-py/fb_sweep/sweep_wmt_en2de_transformer_big_localsgd.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and 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 sweep from sweep import hyperparam PREDIFINED_GRID_FUNCTION = {} def register_grid(name): def register_gr...
bart_ls-main
fairseq-py/fb_sweep/sweep_translation_multi_simple_epoch.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam # These hyperparameters are tuned for RoBERTa-large tasks = { "MNLI": ...
bart_ls-main
fairseq-py/fb_sweep/sweep_roberta_large_glue.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): max_update = 500000 return [ hyperpa...
bart_ls-main
fairseq-py/fb_sweep/sweep_roberta_base.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): target_batch_size = 128 max_tokens = 2048 ...
bart_ls-main
fairseq-py/fb_sweep/sweep_lm_wikitext103_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. #!/usr/bin/env python3 def set_data_based_on_shortname(args): def set_data(fmt, num_shards): if num_shards == 0: ar...
bart_ls-main
fairseq-py/fb_sweep/sweep_lm_data.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam from sweep_wmt_en2de_transformer_big_common import get_common_grid COMMON_...
bart_ls-main
fairseq-py/fb_sweep/sweep_wmt_en2de_transformer_big_sgp.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from sweep import hyperparam def get_common_grid(): return [ hyperparam("--fp16", save_dir_key=lambda va...
bart_ls-main
fairseq-py/fb_sweep/sweep_wmt_en2de_transformer_big_common.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): """ Replicates the `16-bit+cumul+2x lr` result...
bart_ls-main
fairseq-py/fb_sweep/sweep_wmt_en2de_transformer_big.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python """ Usage: ./fb_sweep/sweep_lm_enwik8_transformer_xl.py \ -d ~daju/data/enwik8/eos-data-bin/ \ -p enwiki8.tran...
bart_ls-main
fairseq-py/fb_sweep/sweep_lm_enwik8_transformer_xl.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): config = "8k" # 2k if config == "8k": ...
bart_ls-main
fairseq-py/fb_sweep/sweep_multilingual_masked_lm.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam CC25 = sorted( [ "en_XX", "ar_A...
bart_ls-main
fairseq-py/fb_sweep/sweep_mbart.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and 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 fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/long_pretrain/sweep_t5_baseline...
bart_ls-main
fairseq-py/fb_sweep/long_pretrain/sweep_t5_baseline.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/long_pretrain/sweep_model_deno...
bart_ls-main
fairseq-py/fb_sweep/long_pretrain/sweep_model_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. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/long_pretrain/sweep_pegasus.py ...
bart_ls-main
fairseq-py/fb_sweep/long_pretrain/sweep_pegasus.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python import sweep from sweep import hyperparam def get_grid(args): model_size = 'large' fp16 = True # some model...
bart_ls-main
fairseq-py/fb_sweep/long_pretrain/sweep_from_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. from fairseq.models.bart import BARTModel from fairseq.tasks.denoising import DenoisingTask from fairseq.tasks.pegasus import PegasusTask fr...
bart_ls-main
fairseq-py/fb_sweep/long_pretrain/initialize_models_pegasus.py
# Copyright (c) Facebook, Inc. and 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 datetime import hashlib import itertools import os import random import shlex import shutil import subprocess import textwrap from col...
bart_ls-main
fairseq-py/fb_sweep/sweep/slurm.py
# Copyright (c) Facebook, Inc. and 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 datetime import os import socket from typing import List, Optional def csv_str_list(x): return [y.strip() for y ...
bart_ls-main
fairseq-py/fb_sweep/sweep/__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 itertools import os import random import shlex import subprocess from collections import OrderedDict def main(get_grid, postprocess_...
bart_ls-main
fairseq-py/fb_sweep/sweep/tpu.py
# Copyright (c) Facebook, Inc. and 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 json import os import random import shlex import shutil import subprocess import tempfile from collections import Ord...
bart_ls-main
fairseq-py/fb_sweep/sweep/fblearner.py
# Copyright (c) Facebook, Inc. and 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 os import random import shlex import subprocess import sys import tempfile import time from collections import Ordere...
bart_ls-main
fairseq-py/fb_sweep/sweep/chronos.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python """ python fb_sweep/long_finetune/sweep_summ.py -p ss_large_all \ -d /fsx/xwhan/data/summscreen/fd-bin \ -g 8 -n 1...
bart_ls-main
fairseq-py/fb_sweep/long_finetune/sweep_block_baseline.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and 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 fb_sweep/long_finetune/sweep_summ.py -p ss_large_all \ -d /fsx/xwhan/data/summscreen/fd-bin \ -g 8 -n 1 -...
bart_ls-main
fairseq-py/fb_sweep/long_finetune/sweep_summ.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/long_finetune/sweep_qmsum.py...
bart_ls-main
fairseq-py/fb_sweep/long_finetune/sweep_qmsum.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ ### r3f and ft on the scrolls python fb_swe...
bart_ls-main
fairseq-py/fb_sweep/long_finetune/sweep_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. #!/usr/bin/env python from fb_sweep import sweep from fb_sweep.sweep import hyperparam """ python fb_sweep/long_finetune/sweep_qa.py -p n...
bart_ls-main
fairseq-py/fb_sweep/long_finetune/sweep_qa.py
# Copyright (c) Facebook, Inc. and 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 import string import tempfile import unittest import torch from fairseq import tokenizer from fairseq.data import Diction...
bart_ls-main
fairseq-py/tests/test_dictionary.py
# Copyright (c) Facebook, Inc. and 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 functools import unittest from typing import Any, Dict, Sequence import fairseq import fairseq.options import fairseq.tasks import tor...
bart_ls-main
fairseq-py/tests/test_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. import unittest import torch from fairseq import utils class TestUtils(unittest.TestCase): def test_convert_padding_direction(self): ...
bart_ls-main
fairseq-py/tests/test_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 unittest from copy import deepcopy from dataclasses import dataclass from typing import Optional import torch from fairseq.models.ema ...
bart_ls-main
fairseq-py/tests/test_ema.py
# Copyright (c) Facebook, Inc. and 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 unittest from fairseq.data import iterators class TestIterators(unittest.TestCase): def test_counting_iterator_index(self, ref=N...
bart_ls-main
fairseq-py/tests/test_iterators.py
# Copyright (c) Facebook, Inc. and 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 unittest from typing import Dict, List import tests.utils as test_utils import torch from fairseq import utils from fairseq.data impor...
bart_ls-main
fairseq-py/tests/test_noising.py
# Copyright (c) Facebook, Inc. and 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 tempfile import unittest import torch from fairseq.data.dictionary import Dictionary from fairseq.models.lstm import L...
bart_ls-main
fairseq-py/tests/test_lstm_jitable.py
# Copyright (c) Facebook, Inc. and 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 copy import unittest import torch from torch.cuda.amp import autocast, GradScaler from fairseq.optim import build_opti...
bart_ls-main
fairseq-py/tests/test_amp_optimizer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from fairseq.modules.sparse_multihead_attention import SparseMultiheadAttention class TestSparseMultiheadAtten...
bart_ls-main
fairseq-py/tests/test_sparse_multihead_attention.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import uuid from fairseq import metrics class TestMetrics(unittest.TestCase): def test_nesting(self): with metr...
bart_ls-main
fairseq-py/tests/test_metrics.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import logging import unittest from io import StringIO from unittest.mock import MagicMock, patch import torch from fairseq...
bart_ls-main
fairseq-py/tests/test_train.py
# Copyright (c) Facebook, Inc. and 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 source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import...
bart_ls-main
fairseq-py/tests/fb_test_pathhandlers.py
# Copyright (c) Facebook, Inc. and 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 unittest import tests.utils as test_utils import torch from fairseq.sequence_scorer import SequenceScorer class Test...
bart_ls-main
fairseq-py/tests/test_sequence_scorer.py
# Copyright (c) Facebook, Inc. and 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 unittest from fairseq.dataclass.utils import convert_namespace_to_omegaconf from fairseq.models.transformer import Tran...
bart_ls-main
fairseq-py/tests/test_inference_dropout.py
# Copyright (c) Facebook, Inc. and 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 unittest import torch from fairseq.modules.multihead_attention import MultiheadAttention class TestMultiheadAttention(unittest.TestC...
bart_ls-main
fairseq-py/tests/test_multihead_attention.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import numpy as np from fairseq.data.data_utils_fast import batch_by_size_fn from fairseq.data.data_utils_fast import batch_b...
bart_ls-main
fairseq-py/tests/test_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 os import random import string import typing as tp import unittest from collections import Counter from tempfile import NamedTemporaryF...
bart_ls-main
fairseq-py/tests/test_huffman.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import logging import os import tempfile import unittest from io import StringIO from unittest.mock import patch from fairs...
bart_ls-main
fairseq-py/tests/test_checkpoint_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 unittest from unittest import mock class TestIOPath(unittest.TestCase): def test_no_iopath(self): from .test_reproducibi...
bart_ls-main
fairseq-py/tests/test_iopath.py
# Copyright (c) Facebook, Inc. and 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 unittest import numpy as np from fairseq.data import ListDataset, ResamplingDataset class TestResamplingDataset(u...
bart_ls-main
fairseq-py/tests/test_resampling_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 shutil import tempfile import unittest from fairseq import options from fairseq.dataclass.utils import convert_namespace_to...
bart_ls-main
fairseq-py/tests/test_valid_subset_checks.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
bart_ls-main
fairseq-py/tests/__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 unittest import tests.utils as test_utils import torch from fairseq.data import ( BacktranslationDataset, LanguagePairDataset,...
bart_ls-main
fairseq-py/tests/test_backtranslation_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 contextlib import unittest import tempfile from io import StringIO import numpy as np from tests.utils import create_dummy_data, pre...
bart_ls-main
fairseq-py/tests/test_plasma_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 contextlib import logging import os import tempfile import unittest from io import StringIO import torch from tests.test_binaries impo...
bart_ls-main
fairseq-py/tests/fb_test_binaries.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import contextlib import logging import json import os import random import sys import tempfile import unittest from io import StringIO from t...
bart_ls-main
fairseq-py/tests/test_binaries.py
# Copyright (c) Facebook, Inc. and 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 import unittest import torch from fairseq.token_generation_constraints import * def tensorize(constraints: List[List[int]]) -> t...
bart_ls-main
fairseq-py/tests/test_constraints.py
# Copyright (c) Facebook, Inc. and 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 copy import unittest import tests.utils as test_utils import torch from fairseq.criterions.cross_entropy import CrossE...
bart_ls-main
fairseq-py/tests/test_label_smoothing.py
# Copyright (c) Facebook, Inc. and 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 json import os import random import sys from io import StringIO import torch import torch.nn.functional as F from fair...
bart_ls-main
fairseq-py/tests/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import unittest from typing import Sequence from fairseq.data import LanguagePairDataset, ListDataset, RoundRobinZipDatasets f...
bart_ls-main
fairseq-py/tests/test_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 unittest import torch import torch.nn as nn from fairseq.modules import ConvTBC class TestConvTBC(unittest.TestCase): def test_c...
bart_ls-main
fairseq-py/tests/test_convtbc.py
# Copyright (c) Facebook, Inc. and 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 unittest from collections import OrderedDict import torch from fairseq.data import LanguagePairDataset, TokenBlockDataset from fairseq...
bart_ls-main
fairseq-py/tests/test_multi_corpus_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 argparse import copy import logging import unittest import torch from fairseq.optim.fp16_optimizer import FP16Optimizer, MemoryEfficie...
bart_ls-main
fairseq-py/tests/test_fp16_optimizer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import unittest import torch from fairseq.optim.adam import FairseqAdam from fairseq.optim.fp16_optimizer impo...
bart_ls-main
fairseq-py/tests/test_memory_efficient_fp16.py
# Copyright (c) Facebook, Inc. and 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 unittest import tests.utils as test_utils import torch from fairseq.data import TokenBlockDataset class TestTokenBlockDataset(unitte...
bart_ls-main
fairseq-py/tests/test_token_block_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 argparse import tempfile import unittest import math import numpy as np import tests.utils as test_utils import torch from fairseq im...
bart_ls-main
fairseq-py/tests/test_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. # 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...
bart_ls-main
fairseq-py/tests/test_file_chunker_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 unittest from argparse import ArgumentParser from dataclasses import dataclass, field from fairseq.dataclass import FairseqDataclass f...
bart_ls-main
fairseq-py/tests/test_dataclass_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 unittest import torch from fairseq.data import LanguagePairDataset, TokenBlockDataset from fairseq.data.concat_dataset import ConcatDa...
bart_ls-main
fairseq-py/tests/test_concat_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 contextlib import logging import unittest from io import StringIO import torch from fairseq import fb_hub @unittest.skipIf(not torch...
bart_ls-main
fairseq-py/tests/fb_test_hub.py