repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
rej-summ
rej-summ-main/fairseq/data/transform_eos_concat_langpair_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 torch from torch.utils.data.dataloader import default_collate from fairseq.data import ConcatDataset logger = logging...
5,170
35.935714
111
py
rej-summ
rej-summ-main/fairseq/data/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 numpy as np import torch from fairseq.data import FairseqDataset, plasma_utils from fairseq.data.indexed_dataset import best_fitting_in...
7,652
35.971014
87
py
rej-summ
rej-summ-main/fairseq/data/subsample_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 numpy as np from . import BaseWrapperDataset logger = logging.getLogger(__name__) class SubsampleDataset(BaseWrapp...
2,117
28.013699
101
py
rej-summ
rej-summ-main/fairseq/data/prepend_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 numpy as np import torch from . import BaseWrapperDataset class PrependDataset(BaseWrapperDataset): def __init__(self, dataset, ...
953
31.896552
83
py
rej-summ
rej-summ-main/fairseq/data/base_wrapper_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. from torch.utils.data.dataloader import default_collate from . import FairseqDataset class BaseWrapperDataset(FairseqDataset): def __in...
2,153
26.265823
70
py
rej-summ
rej-summ-main/fairseq/data/raw_label_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 torch from . import FairseqDataset class RawLabelDataset(FairseqDataset): def __init__(self, labels): super().__init__()...
546
21.791667
65
py
rej-summ
rej-summ-main/fairseq/data/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 logging import numpy as np from fairseq.data import BaseWrapperDataset, plasma_utils logger = logging.getLogger(__name__) class Re...
4,314
29.821429
78
py
rej-summ
rej-summ-main/fairseq/data/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 os from collections import Counter from multiprocessing import Pool import torch from fairseq import utils from fairseq.data import da...
12,903
31.099502
96
py
rej-summ
rej-summ-main/fairseq/data/append_token_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 numpy as np import torch from . import BaseWrapperDataset class AppendTokenDataset(BaseWrapperDataset): def __init__(self, datas...
1,065
24.380952
65
py
rej-summ
rej-summ-main/fairseq/data/codedataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import logging import os import random from pathlib import Path import numpy as np import torch import torch.utils.data from . ...
18,486
31.039861
109
py
rej-summ
rej-summ-main/fairseq/data/fasta_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 subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(prefix_path): ...
3,387
30.37037
107
py
rej-summ
rej-summ-main/fairseq/data/mask_tokens_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. from functools import lru_cache import numpy as np import torch from fairseq.data import Dictionary, data_utils from . import BaseWrapperDat...
8,777
38.719457
102
py
rej-summ
rej-summ-main/fairseq/data/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 bisect import numpy as np from torch.utils.data.dataloader import default_collate from . import FairseqDataset class ConcatDataset(...
4,645
36.168
86
py
rej-summ
rej-summ-main/fairseq/data/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. try: from collections.abc import Iterable except ImportError: from collections import Iterable import contextlib import itertools impo...
21,791
35.019835
120
py
rej-summ
rej-summ-main/fairseq/data/nested_dictionary_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. from collections import OrderedDict import torch from torch.utils.data.dataloader import default_collate from . import FairseqDataset def ...
4,029
30.984127
86
py
rej-summ
rej-summ-main/fairseq/data/add_target_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 torch from . import BaseWrapperDataset, data_utils from fairseq.data.text_compressor import TextCompressor, TextCompressionLevel cla...
2,996
34.678571
88
py
rej-summ
rej-summ-main/fairseq/data/transform_eos_lang_pair_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. from typing import Optional import torch from . import FairseqDataset class TransformEosLangPairDataset(FairseqDataset): """A :class:...
3,856
32.833333
98
py
rej-summ
rej-summ-main/fairseq/data/lm_context_window_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 numpy as np import torch from typing import Dict from fairseq.data.monolingual_dataset import MonolingualDataset from . import Fairse...
3,381
33.510204
90
py
rej-summ
rej-summ-main/fairseq/data/span_mask_tokens_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 numpy as np import torch from . import Dictionary, FairseqDataset, data_utils def collate( samples, pad_idx, eos_idx, ...
10,888
36.037415
206
py
rej-summ
rej-summ-main/fairseq/data/colorize_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 torch from . import BaseWrapperDataset class ColorizeDataset(BaseWrapperDataset): """Adds 'colors' property to net input that is...
843
31.461538
111
py
rej-summ
rej-summ-main/fairseq/data/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 itertools import logging import math import operator import os import queue import time from threading import Thread from typing import...
31,799
34.972851
94
py
rej-summ
rej-summ-main/fairseq/data/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 torch from fairseq import utils from . import FairseqDataset def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True):...
6,247
36.638554
84
py
rej-summ
rej-summ-main/fairseq/data/monolingual_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 numpy as np import torch from . import FairseqDataset, data_utils def collate(samples, pad_idx, eos_idx, fixed_pad_length=None, pad_...
8,832
33.775591
110
py
rej-summ
rej-summ-main/fairseq/data/roll_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 torch from . import BaseWrapperDataset class RollDataset(BaseWrapperDataset): def __init__(self, dataset, shifts): super...
485
24.578947
65
py
rej-summ
rej-summ-main/fairseq/data/replace_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. from . import BaseWrapperDataset class ReplaceDataset(BaseWrapperDataset): """Replaces tokens found in the dataset by a specified replac...
1,370
36.054054
113
py
rej-summ
rej-summ-main/fairseq/data/id_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 torch from . import FairseqDataset class IdDataset(FairseqDataset): def __getitem__(self, index): return index def ...
423
20.2
65
py
rej-summ
rej-summ-main/fairseq/data/indexed_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 shutil import struct from functools import lru_cache import numpy as np import torch from fairseq.dataclass.constants import DATASET_I...
18,265
30.064626
102
py
rej-summ
rej-summ-main/fairseq/data/denoising_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 math import numpy as np import torch from . import FairseqDataset, data_utils def collate( samples, pad_idx, eos_idx, ...
15,685
34.328829
88
py
rej-summ
rej-summ-main/fairseq/data/prepend_token_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 numpy as np import torch from . import BaseWrapperDataset class PrependTokenDataset(BaseWrapperDataset): def __init__(self, data...
1,066
24.404762
65
py
rej-summ
rej-summ-main/fairseq/data/numel_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 numpy as np import torch from . import BaseWrapperDataset class NumelDataset(BaseWrapperDataset): def __init__(self, dataset, re...
786
23.59375
65
py
rej-summ
rej-summ-main/fairseq/data/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 numpy as np import torch from fairseq.data import data_utils class WordNoising(object): """Generate a noisy version of a sentence...
12,422
36.083582
88
py
rej-summ
rej-summ-main/fairseq/data/bucket_pad_length_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 numpy as np import torch.nn.functional as F from fairseq.data import BaseWrapperDataset from fairseq.data.data_utils import get_buckets...
2,360
28.886076
79
py
rej-summ
rej-summ-main/fairseq/data/concat_sentences_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 torch from . import FairseqDataset class ConcatSentencesDataset(FairseqDataset): def __init__(self, *datasets): super()....
1,558
27.345455
83
py
rej-summ
rej-summ-main/fairseq/data/fairseq_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 numpy as np import torch.utils.data from fairseq.data import data_utils logger = logging.getLogger(__name__) class Ep...
7,123
33.582524
91
py
rej-summ
rej-summ-main/fairseq/data/transform_eos_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 torch from . import FairseqDataset class TransformEosDataset(FairseqDataset): """A :class:`~fairseq.data.FairseqDataset` wrapper...
4,575
36.818182
88
py
rej-summ
rej-summ-main/fairseq/data/multilingual/sampled_multi_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 datetime import hashlib import logging import time from bisect import bisect_right from collections import OrderedDict, defaultdict fro...
18,339
38.104478
119
py
rej-summ
rej-summ-main/fairseq/data/multilingual/multilingual_utils.py
from enum import Enum from typing import Dict, List, Optional, Sequence import torch from fairseq.data import Dictionary class EncoderLangtok(Enum): """ Prepend to the beginning of source sentence either the source or target language token. (src/tgt). """ src = "src" tgt = "tgt" class Lang...
1,623
24.375
85
py
rej-summ
rej-summ-main/fairseq/data/multilingual/sampled_multi_epoch_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 hashlib import logging import math import numpy as np from fairseq.data import SampledMultiDataset from .sampled_multi_dataset impor...
7,823
38.12
119
py
rej-summ
rej-summ-main/fairseq/data/audio/hubert_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 itertools import logging import os import sys from typing import Any, List, Optional, Union import numpy as np import torch import to...
12,719
34.630252
86
py
rej-summ
rej-summ-main/fairseq/data/audio/multi_modality_dataset.py
# Copyright (c) 2021-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import math from ty...
10,161
34.65614
93
py
rej-summ
rej-summ-main/fairseq/data/audio/speech_to_speech_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 from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Optional, Tuple import torch from f...
13,850
35.45
99
py
rej-summ
rej-summ-main/fairseq/data/audio/text_to_speech_dataset.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.abs from dataclasses import datacla...
8,669
33.541833
87
py
rej-summ
rej-summ-main/fairseq/data/audio/frm_text_to_speech_dataset.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.abs import csv import logging impor...
6,923
32.61165
86
py
rej-summ
rej-summ-main/fairseq/data/audio/raw_audio_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 sys import io import numpy as np import torch import torch.nn.functional as F from .. import FairseqDataset...
13,679
33.720812
111
py
rej-summ
rej-summ-main/fairseq/data/audio/audio_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 mmap from pathlib import Path import io from typing import BinaryIO, List, Optional, Tuple, Union import numpy as np import torch imp...
13,330
33.182051
84
py
rej-summ
rej-summ-main/fairseq/data/audio/speech_to_text_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 csv import logging import re from argparse import Namespace from collections import defaultdict from dataclasses import dataclass from ...
26,935
35.697548
87
py
rej-summ
rej-summ-main/fairseq/data/audio/speech_to_text_joint_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 from pathlib import Path from typing import Dict, List, NamedTuple, Optional import torch from fairseq.data import ConcatData...
12,746
34.408333
86
py
rej-summ
rej-summ-main/fairseq/data/audio/dataset_transforms/noisyoverlapaugment.py
import numpy as np import torch from fairseq.data.audio import rand_uniform from fairseq.data.audio.dataset_transforms import ( AudioDatasetTransform, register_audio_dataset_transform, ) from fairseq.data.audio.waveform_transforms.noiseaugment import ( NoiseAugmentTransform, ) _DEFAULTS = { "rate": 0....
3,743
34.320755
86
py
rej-summ
rej-summ-main/fairseq/data/audio/feature_transforms/delta_deltas.py
import numpy as np import torch from fairseq.data.audio.feature_transforms import ( AudioFeatureTransform, register_audio_feature_transform, ) @register_audio_feature_transform("delta_deltas") class DeltaDeltas(AudioFeatureTransform): """Expand delta-deltas features from spectrum.""" @classmethod ...
1,192
30.394737
79
py
rej-summ
rej-summ-main/fairseq/data/encoders/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq.data import encoders def get_whole_word_mask(args, dictionary): bpe = encoders.build_bpe(args) if bpe is n...
909
28.354839
67
py
rej-summ
rej-summ-main/fairseq/data/huffman/huffman_mmap_indexed_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 mmap import os import shutil import struct import typing as tp from functools import lru_cache import numpy as np import torch from fa...
8,807
29.583333
108
py
rej-summ
rej-summ-main/fairseq/data/legacy/block_pair_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 math import numpy as np import torch from fairseq.data import FairseqDataset class BlockPairDataset(FairseqDataset): """Break a ...
12,877
40.275641
99
py
rej-summ
rej-summ-main/fairseq/data/legacy/masked_lm_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 math from typing import Dict, List, Tuple import numpy as np import torch from fairseq.data import Dictionary, FairseqDataset, data_ut...
12,168
39.029605
88
py
rej-summ
rej-summ-main/fairseq/tasks/text_to_speech.py
# Copyright (c) Facebook, Inc. and 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 os.path as op import torch import torch.nn.functional as F import numpy as np from fairseq.data.audio.text_t...
17,256
33.376494
88
py
rej-summ
rej-summ-main/fairseq/tasks/translation_from_pretrained_bart.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq import utils from fairseq.data import LanguagePairDataset from . import register_task from .translation import Tran...
5,243
38.428571
108
py
rej-summ
rej-summ-main/fairseq/tasks/language_modeling.py
# Copyright (c) Facebook, Inc. and 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 Optional import numpy as np import torch from fairseq im...
13,952
35.335938
91
py
rej-summ
rej-summ-main/fairseq/tasks/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 dataclasses import dataclass, field import itertools import json import logging import os from os import path from typing import Optional...
18,865
35.141762
108
py
rej-summ
rej-summ-main/fairseq/tasks/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. import logging import os import numpy as np import torch from fairseq import utils from fairseq.data import ( ConcatDataset, Diction...
12,144
34.825959
87
py
rej-summ
rej-summ-main/fairseq/tasks/multilingual_language_modeling.py
# Copyright (c) Facebook, Inc. and 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 Optional import numpy as np import torch from omegaconf ...
22,960
35.562102
102
py
rej-summ
rej-summ-main/fairseq/tasks/online_backtranslation.py
# Copyright (c) Facebook, Inc. and 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 json import logging import math import os from argparse import Namespace from collections import OrderedDict, default...
28,618
40.901903
118
py
rej-summ
rej-summ-main/fairseq/tasks/speech_ulm_task.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import sys import t...
7,533
32.484444
88
py
rej-summ
rej-summ-main/fairseq/tasks/multilingual_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. import contextlib import logging import os from collections import OrderedDict from argparse import ArgumentError import torch from fairseq i...
18,165
38.235421
118
py
rej-summ
rej-summ-main/fairseq/tasks/translation_lev.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field import torch from fairseq import utils from fairseq.data import LanguagePairDataset from fairseq.data...
7,416
36.841837
103
py
rej-summ
rej-summ-main/fairseq/tasks/fairseq_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 import warnings from argparse import Namespace from typing import Any, Callable, Dict, List import torch from fairse...
26,707
37.428777
110
py
rej-summ
rej-summ-main/fairseq/tasks/speech_to_speech.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import logging import math from argparse import Namespace from pathlib import Path from typing import List import torch import to...
22,609
36.809365
130
py
rej-summ
rej-summ-main/fairseq/tasks/nlu_finetuning.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import os import to...
19,006
38.763598
95
py
rej-summ
rej-summ-main/fairseq/tasks/audio_finetuning.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import logging import os import to...
13,503
38.255814
95
py
rej-summ
rej-summ-main/fairseq/tasks/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. import datetime import logging import time import torch from fairseq.data import ( FairseqDataset, LanguagePairDataset, ListDatas...
17,926
39.558824
113
py
rej-summ
rej-summ-main/docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # fairseq documentation build configuration file, created by # sphinx-quickstart on Fri Aug 17 21:45:30 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
3,133
30.656566
79
py
rej-summ
rej-summ-main/fairseq_cli/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. """ Translate pre-processed data with a trained model. """ import ast import logging import math import os import sy...
15,805
36.813397
180
py
rej-summ
rej-summ-main/fairseq_cli/validate.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 logging import os import sys from argparse import Namespace from itertools import chain import torch from om...
5,228
32.954545
88
py
rej-summ
rej-summ-main/fairseq_cli/hydra_train.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 logging import os import hydra import torch from hydra.core.hydra_config import HydraConfig from omegaconf i...
2,714
28.51087
116
py
rej-summ
rej-summ-main/fairseq_cli/eval_lm.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. """ Evaluate the perplexity of a trained language model. """ import logging import math import os import sys from a...
11,960
33.37069
108
py
rej-summ
rej-summ-main/fairseq_cli/interactive.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. """ Translate raw text with a trained model. Batches data on-the-fly. """ import ast import fileinput import logging...
11,465
35.056604
88
py
rej-summ
rej-summ-main/fairseq_cli/train.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. """ Train a new model on one or across multiple GPUs. """ import argparse import logging import math import os impor...
19,932
34.279646
108
py
graphmp
graphmp-master/graphmp.py
# -*- coding: utf-8 -*- # !/usr/bin/env python import numpy as np import tensorflow as tf import argparse import math import glob import tensorflow.contrib.layers as layers import os import random from tensorflow.contrib import rnn from sklearn import metrics def pairwise_distance(cate_pattern): """Compute pair...
30,765
46.773292
165
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/caffe2_validate.py
""" Caffe2 validation script This script is created to verify exported ONNX models running in Caffe2 It utilizes the same PyTorch dataloader/processing pipeline for a fair comparison against the originals. Copyright 2020 Ross Wightman """ import argparse import numpy as np from caffe2.python import core, workspace, m...
5,993
42.122302
113
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/setup.py
""" Setup """ from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() exec(open('geffnet/version....
1,737
35.208333
81
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/hubconf.py
dependencies = ['torch', 'math'] from geffnet import efficientnet_b0 from geffnet import efficientnet_b1 from geffnet import efficientnet_b2 from geffnet import efficientnet_b3 from geffnet import efficientnet_es from geffnet import efficientnet_lite0 from geffnet import mixnet_s from geffnet import mixnet_m from g...
2,730
31.129412
52
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/validate.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import time import torch import torch.nn as nn import torch.nn.parallel from contextlib import suppress import geffnet from data import Dataset, create_loader, resolve_data_config from utils im...
6,632
38.718563
94
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/caffe2_benchmark.py
""" Caffe2 validation script This script runs Caffe2 benchmark on exported ONNX model. It is a useful tool for reporting model FLOPS. Copyright 2020 Ross Wightman """ import argparse from caffe2.python import core, workspace, model_helper from caffe2.proto import caffe2_pb2 parser = argparse.ArgumentParser(descript...
2,428
35.80303
91
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/onnx_to_caffe.py
import argparse import onnx from caffe2.python.onnx.backend import Caffe2Backend parser = argparse.ArgumentParser(description="Convert ONNX to Caffe2") parser.add_argument("model", help="The ONNX model") parser.add_argument("--c2-prefix", required=True, help="The output file prefix for the caffe2 model init and...
843
29.142857
84
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/onnx_export.py
""" ONNX export script Export PyTorch models as ONNX graphs. This export script originally started as an adaptation of code snippets found at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph for h...
5,821
47.115702
119
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/efficientnet_builder.py
""" EfficientNet / MobileNetV3 Blocks and Builder Copyright 2020 Ross Wightman """ import re from copy import deepcopy from .conv2d_layers import * from geffnet.activations import * __all__ = ['get_bn_args_tf', 'resolve_bn_args', 'resolve_se_args', 'resolve_act_layer', 'make_divisible', 'round_channels', ...
26,514
37.76462
124
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/conv2d_layers.py
""" Conv2D w/ SAME padding, CondConv, MixedConv A collection of conv layers and padding helpers needed by EfficientNet, MixNet, and MobileNetV3 models that maintain weight compatibility with original Tensorflow models. Copyright 2020 Ross Wightman """ import collections.abc import math from functools import partial f...
12,093
38.652459
119
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/gen_efficientnet.py
""" Generic Efficient Networks A generic MobileNet class with building blocks to support a variety of models: * EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/AdvProp/NoisyStudent ports) - EfficientNet: Rethinking Model Scaling for CNNs - https://arxiv.org/abs/1905.11946 - CondConv: Conditionally...
59,925
40.299793
144
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/mobilenetv3.py
""" MobileNet-V3 A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl. Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244 Hacked together by / Copyright 2020 Ross Wightman """ import torch.nn as nn import torch.nn.functional as F from .activations import get_act_fn, get_act...
15,009
40.123288
137
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/config.py
""" Global layer config state """ from typing import Any, Optional __all__ = [ 'is_exportable', 'is_scriptable', 'is_no_jit', 'layer_config_kwargs', 'set_exportable', 'set_scriptable', 'set_no_jit', 'set_layer_config' ] # Set to True if prefer to have layers with no jit optimization (includes activations) _NO...
3,350
26.024194
102
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/helpers.py
""" Checkpoint loading / state_dict helpers Copyright 2020 Ross Wightman """ import torch import os from collections import OrderedDict try: from torch.hub import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url def load_checkpoint(model, chec...
2,833
38.361111
107
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/activations/activations_jit.py
""" Activations (jit) A collection of jit-scripted activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not currently work across in-place ...
2,294
27.6875
107
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/activations/activations_me.py
""" Activations (memory-efficient w/ custom autograd) A collection of activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. These activations are not compatible with jit scripting or ONNX export of the model, please use either the JIT or bas...
4,549
25
108
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/activations/activations.py
""" Activations A collection of activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. Copyright 2020 Ross Wightman """ from torch import nn as nn from torch.nn import functional as F def swish(x, inplace: bool = False): """Swish - Desc...
2,690
25.126214
107
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/geffnet/activations/__init__.py
from geffnet import config from geffnet.activations.activations_me import * from geffnet.activations.activations_jit import * from geffnet.activations.activations import * import torch _has_silu = 'silu' in dir(torch.nn.functional) _ACT_FN_DEFAULT = dict( silu=F.silu if _has_silu else swish, swish=F.silu if _...
4,170
29.224638
104
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/data/dataset.py
""" Quick n simple image folder dataset Copyright 2020 Ross Wightman """ import torch.utils.data as data import os import re import torch from PIL import Image IMG_EXTENSIONS = ['.png', '.jpg', '.jpeg'] def natural_key(string_): """See http://www.codinghorror.com/blog/archives/001018.html""" return [int(s...
3,000
31.619565
109
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/data/loader.py
""" Fast Collate, CUDA Prefetcher Prefetcher and Fast Collate inspired by NVIDIA APEX example at https://github.com/NVIDIA/apex/commit/d5e2bb4bdeedd27b1dfaf5bb2b24d6c000dee9be#diff-cf86c282ff7fba81fad27a559379d5bf Hacked together by / Copyright 2020 Ross Wightman """ import torch import torch.utils.data from .transfo...
3,113
27.568807
116
py
gen-efficientnet-pytorch
gen-efficientnet-pytorch-master/data/transforms.py
import torch from torchvision import transforms from PIL import Image import math import numpy as np DEFAULT_CROP_PCT = 0.875 IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5) IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5) IMAGENET_DPN_MEAN ...
4,760
30.529801
96
py
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/inference.py
import torch import matplotlib.pyplot as plt import pickle as pk import numpy as np from tqdm import tqdm from scipy.signal import butter, lfilter import h5py def butter_bandpass(lowcut, highcut, fs, order=5): nyq = 0.5 * fs low = lowcut / nyq high = highcut / nyq b, a = butter(order, [low, high], btyp...
1,562
29.057692
82
py
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/preprocessing.py
import torch import numpy as np import os import matplotlib.pyplot as plt def read_csv(file_path): f = open(file_path) content = f.readline().split(',') output = [] for item in content: output.append(float(item)) f.close() return output class Dataset(): def __init__(self): ...
1,348
24.942308
96
py
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/loss_functions.py
import numpy as np from torch.autograd.variable import Variable import torch import torch.nn as nn import torch.nn.functional as F import math def _torch_welch(data, fs=40.0, nperseg=400, noverlap=None, average='mean', device='cpu',return_list = False): """ Compute PSD using Welch's method. """...
8,860
34.874494
118
py
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/test_welch.py
from loss_functions import _torch_welch from scipy.signal import welch from PPGDataset_40hz import PPGDataloader import torch import matplotlib.pyplot as plt import numpy as np def read_csv(file_path): f = open(file_path) content = f.readline().split(',') output = [] for item in content: output...
848
24.727273
67
py