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
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_optimization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
6,444
41.401316
110
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_marian.py
# coding=utf-8 # Copyright 2020 HuggingFace Inc. team. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
9,383
34.680608
117
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_ctrl.py
# coding=utf-8 # Copyright 2018 Salesforce and HuggingFace Inc. team. # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
7,900
33.352174
110
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_flaubert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
12,049
32.472222
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_mobilebert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
19,333
38.217039
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_tf_distilbert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
9,701
38.762295
118
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_doc_samples.py
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
4,326
37.292035
114
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_tokenization_transfo_xl.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
3,299
32.673469
106
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_xlnet.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
26,745
28.166848
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_camembert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
1,904
36.352941
99
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_tf_transfo_xl.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
15,933
27.555556
103
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_tokenization_marian.py
# coding=utf-8 # Copyright 2020 Huggingface # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
3,683
38.191489
105
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_electra.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
12,928
33.662198
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_tokenization_utils.py
# coding=utf-8 # Copyright 2018 HuggingFace Inc.. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
5,841
41.333333
109
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_onnx.py
import unittest from os.path import dirname, exists from shutil import rmtree from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import convert, ensure_valid_input, infer_shapes from trans...
5,853
40.51773
112
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_activations.py
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): from transformers.activations import _gelu_python, get_activation, gelu_new import torch @require_torch class TestActivations(unittest.TestCase): def test_gelu_versi...
953
30.8
81
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_pipelines.py
import unittest from typing import Iterable, List, Optional from transformers import pipeline from transformers.pipelines import SUPPORTED_TASKS, DefaultArgumentHandler, Pipeline from transformers.testing_utils import require_tf, require_torch, slow, torch_device DEFAULT_DEVICE_NUM = -1 if torch_device == "cpu" else...
20,789
49.096386
3,645
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_reformer.py
# coding=utf-8 # Copyright 2020 Huggingface # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
43,396
41.256086
544
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_tokenization_xlm_roberta.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
6,189
29.048544
207
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_gpt2.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
15,288
36.199513
116
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_encoder_decoder.py
# coding=utf-8 # Copyright 2020 HuggingFace Inc. team. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
15,167
40.556164
124
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_common.py
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
41,854
41.752809
133
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_xlm.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
14,239
32.271028
166
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_tf_common.py
# coding=utf-8 # Copyright 2019 HuggingFace Inc. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
36,057
45.169014
130
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_bert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
20,108
36.727955
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_openai.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
8,301
33.882353
111
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_benchmark.py
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import ( PyTorchBenchmarkArguments, PyTorchBenchmark, ) @r...
9,423
38.932203
91
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_roberta.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
15,034
40.648199
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_transfo_xl.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
21,673
31.349254
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_auto.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
9,571
42.908257
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_tokenization_fast.py
import logging import unittest from collections import namedtuple from itertools import takewhile from transformers import ( BertTokenizer, BertTokenizerFast, DistilBertTokenizer, GPT2Tokenizer, GPT2TokenizerFast, OpenAIGPTTokenizer, PreTrainedTokenizer, RobertaTokenizer, TransfoXLT...
43,721
47.851397
119
py
TextSiM
TextSiM-main/MNLI_evaluation_scripts/transformers-3.0.2/tests/test_modeling_albert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
12,399
38.616613
119
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/eval.py
""" Run evaluation with saved models. """ import os import random import argparse import pickle import torch import torch.nn as nn import torch.optim as optim from data.loader import DataLoader from model.rnn import RelationModel from utils import torch_utils, scorer, constant, helper from utils.vocab import Vocab p...
2,380
30.746667
97
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/train.py
""" Train a model on TACRED. """ import os from datetime import datetime import time import numpy as np import random import argparse from shutil import copyfile import torch import torch.nn as nn import torch.optim as optim from data.loader import DataLoader from model.rnn import RelationModel from utils import scor...
6,721
40.751553
117
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/utils/torch_utils.py
""" Utility functions for torch. """ import torch from torch import nn, optim from torch.optim import Optimizer ### class class MyAdagrad(Optimizer): """My modification of the Adagrad optimizer that allows to specify an initial accumulater value. This mimics the behavior of the default Adagrad implementation ...
5,525
33.322981
106
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/data/loader.py
""" Data loader for TACRED json files. """ import json import random import torch import numpy as np from utils import constant, helper, vocab class DataLoader(object): """ Load data from json files, preprocess and prepare batches. """ def __init__(self, filename, batch_size, opt, vocab, evaluation=F...
4,983
35.647059
94
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/model/layers.py
""" Additional layers. """ import torch from torch import nn from torch.nn import init import torch.nn.functional as F from utils import constant, torch_utils class LSTMLayer(nn.Module): """ A wrapper for LSTM with sequence packing. """ def __init__(self, emb_dim, hidden_dim, num_layers, dropout, use_cuda): ...
3,783
36.84
94
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/LSTM/model/rnn.py
""" A rnn model for relation extraction, written in pytorch. """ import math import numpy as np import torch from torch import nn from torch.nn import init import torch.nn.functional as F from utils import constant, torch_utils from model import layers class RelationModel(object): """ A wrapper class for the trai...
7,577
37.467005
99
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/bert.py
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np from transformers import BertModel from utils import constant, torch_utils class BERTencoder(nn.Module): def __init__(self): super().__init__() in_dim = 1024 self.model...
1,039
28.714286
79
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/dataloader.py
""" Data loader for TACRED json files. """ import json import random import torch import numpy as np import string from utils import constant, helper from collections import defaultdict from statistics import mean class DataLoader(object): """ Load data from json files, preprocess and prepare batches. "...
4,299
33.126984
120
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/eval.py
""" Run evaluation with saved models. """ import random import argparse from tqdm import tqdm import torch from dataloader import DataLoader from trainer import BERTtrainer from utils import torch_utils, scorer, constant, helper from nltk.translate.bleu_score import corpus_bleu, sentence_bleu from transformers impor...
2,637
31.567901
127
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/train.py
import os import sys from datetime import datetime import time import numpy as np import random import argparse from shutil import copyfile import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from dataloader import DataLoader from trainer import BERTtrainer from utils imp...
6,151
39.473684
142
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/trainer.py
""" A trainer class. """ import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np from bert import BERTencoder, BERTclassifier from utils import constant, torch_utils from transformers import AdamW class Trainer(object): def __init__(self, opt): ...
3,918
30.352
146
py
TextSiM
TextSiM-main/TACRED_evaluation_scripts/SpanBERT/utils/torch_utils.py
""" Utility functions for torch. """ import torch from torch import nn, optim from torch.optim import Optimizer ### class class MyAdagrad(Optimizer): """My modification of the Adagrad optimizer that allows to specify an initial accumulater value. This mimics the behavior of the default Adagrad implementation ...
5,681
33.858896
106
py
TextSiM
TextSiM-main/TACRED_analysis/create_new_simplified_dataset.py
# create_new_simplified_dataset.py # This file will take the extracted sentences after simplification and # make a new dataset for the original training/evaluating codes from other papers # import neccessary libraries import sys import json #helper to find all occurences of substring def find_all(a_str, sub): st...
6,937
46.197279
258
py
rej-summ
rej-summ-main/preprocessing.py
# -*- coding: utf-8 -*- import os import spacy import torch import logging import argparse from tqdm import tqdm from fairseq.models.bart import BARTModel logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO) def read_lines(file_path): files = [] with open(file_path, 'r', encoding='utf...
3,925
26.263889
111
py
rej-summ
rej-summ-main/setup.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 Extension, find_packages, setup from torch.utils import ...
7,589
28.648438
92
py
rej-summ
rej-summ-main/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. """isort:skip_file""" import functools import importlib dependencies = [ "dataclasses", "hydra", "numpy", "omegaconf", "...
2,099
27.378378
82
py
rej-summ
rej-summ-main/examples/truncated_bptt/transformer_xl_model.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from dataclasses import dataclass, field from typing import Dict, List, Optional import torch from fairseq.dataclass import Fa...
4,738
31.909722
84
py
rej-summ
rej-summ-main/examples/truncated_bptt/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...
9,995
33.951049
86
py
rej-summ
rej-summ-main/examples/linformer/linformer_src/modules/multihead_linear_attention.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from typing import Dict, Optional, Tuple import torch import torch.nn.functional as F from fairseq import utils from fairseq.incr...
19,151
38.73444
98
py
rej-summ
rej-summ-main/examples/linformer/linformer_src/modules/linformer_sentence_encoder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch.nn as nn from fairseq.models.transformer import TransformerEncoder from .linformer_sentence_encoder_layer import Li...
2,151
38.127273
85
py
rej-summ
rej-summ-main/examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq import utils from fairseq.modules import TransformerEncoderLayer from .multihead_linear_attention import MultiheadL...
2,743
40.575758
85
py
rej-summ
rej-summ-main/examples/linformer/linformer_src/models/linformer_roberta.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Linformer: Self-Attention with Linear Complexity """ import logging import torch from fairseq import utils from fairseq.models import reg...
4,143
33.247934
84
py
rej-summ
rej-summ-main/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...
7,680
29.601594
99
py
rej-summ
rej-summ-main/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...
7,020
27.084
135
py
rej-summ
rej-summ-main/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...
9,209
40.300448
246
py
rej-summ
rej-summ-main/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...
22,454
30.405594
129
py
rej-summ
rej-summ-main/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...
22,945
32.351744
87
py
rej-summ
rej-summ-main/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...
4,015
30.131783
129
py
rej-summ
rej-summ-main/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...
3,543
29.817391
110
py
rej-summ
rej-summ-main/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...
1,927
29.125
128
py
rej-summ
rej-summ-main/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 ...
2,496
31.428571
114
py
rej-summ
rej-summ-main/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 ...
6,315
28.933649
129
py
rej-summ
rej-summ-main/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...
3,187
30.88
144
py
rej-summ
rej-summ-main/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...
3,673
29.616667
105
py
rej-summ
rej-summ-main/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...
5,038
28.994048
87
py
rej-summ
rej-summ-main/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,...
15,658
33.567329
102
py
rej-summ
rej-summ-main/examples/criss/save_encoder.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 numpy as np import torch from fairseq import check...
7,473
33.762791
90
py
rej-summ
rej-summ-main/examples/speech_to_speech/generate_waveform_from_code.py
# Copyright (c) Facebook, Inc. and 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 logging from pathlib import Path import random import soundfile as sf import torch from tqdm import tqdm ...
3,285
27.08547
107
py
rej-summ
rej-summ-main/examples/speech_to_speech/benchmarking/core.py
import timeit import logging import torch from pypapi import events, papi_high as high from memory_profiler import memory_usage from torch import nn from argparse import Namespace from fairseq.dataclass.utils import convert_namespace_to_omegaconf from fairseq.data import data_utils as fairseq_data_utils from fairseq im...
17,782
35.440574
131
py
rej-summ
rej-summ-main/examples/speech_to_speech/benchmarking/data_utils.py
from fairseq import tasks import numpy as np import logging import random from fairseq import options import torch import os import soundfile as sf from fairseq.data.audio.audio_utils import ( get_waveform, parse_path, ) logging.basicConfig() logging.root.setLevel(logging.INFO) logging.basicConfig(level=loggi...
7,893
28.788679
127
py
rej-summ
rej-summ-main/examples/speech_to_speech/benchmarking/get_metrics.py
import copy import torch import logging from argparse import Namespace import yaml from fairseq import options from examples.speech_to_speech.benchmarking.core import ( Processing, SpeechGeneration, Cascaded2StageS2ST, Cascaded3StageS2ST, S2UT, ) from examples.speech_to_speech.benchmarking.data_util...
5,053
30.006135
115
py
rej-summ
rej-summ-main/examples/speech_to_speech/unity/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. import math import sys from typing import Dict, List, Optional import torch from torch import Tensor from fairseq.sequence_generator import ...
25,480
39.639553
107
py
rej-summ
rej-summ-main/examples/speech_to_speech/unity/sequence_generator_multi_decoder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Dict, List, Optional import torch import torch.nn as nn from torch import Tensor from fairseq import search class Multi...
10,095
36.671642
95
py
rej-summ
rej-summ-main/examples/speech_to_speech/preprocessing/prep_s2spect_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil import torchaudio import soundfile as ...
5,844
33.382353
125
py
rej-summ
rej-summ-main/examples/bart/summarize.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from fairseq.models.bart import BARTModel import argparse from tqdm import tqdm XSUM_KWARGS = dict(max_len_b=60, min_len=10, no_...
3,864
30.169355
96
py
rej-summ
rej-summ-main/examples/data2vec/models/data2vec_audio.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import math from dataclasses import dataclass, field from typing import Optional from omegaconf import II import torch import...
17,916
32.302974
104
py
rej-summ
rej-summ-main/examples/data2vec/models/data2vec_text.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass, field from typing import Optional import logging import math import torch import torch.nn as nn import tor...
18,697
35.096525
104
py
rej-summ
rej-summ-main/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...
5,881
35.534161
85
py
rej-summ
rej-summ-main/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...
4,374
32.914729
92
py
rej-summ
rej-summ-main/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...
8,540
31.352273
87
py
rej-summ
rej-summ-main/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 metrics, utils from fairseq.criterions impo...
4,233
38.570093
88
py
rej-summ
rej-summ-main/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...
4,692
31.143836
114
py
rej-summ
rej-summ-main/examples/MMPT/setup.py
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="mmpt", version="0.0.1", author="Hu Xu, Po-yao Huang", author_email="huxu@fb.com", description="A package for multimodal pretraining.", long_description=long_description, long_descr...
668
25.76
59
py
rej-summ
rej-summ-main/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 ...
3,937
33.54386
81
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/modules/mm.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...
5,537
36.931507
83
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/modules/vectorpool.py
# Copyright (c) Facebook, Inc. All Rights Reserved import torch import os import numpy as np import pickle from . import retri from ..utils import get_local_rank class VectorPool(object): """ Base class of retrieval space. """ def __init__(self, config): from transformers import AutoConfig ...
8,278
32.518219
82
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/models/transformermodel.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...
26,064
34.462585
87
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/models/mmfusionnlg.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors, Facebook AI Research 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 L...
48,394
47.395
246
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/models/mmfusion.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...
30,634
32.047465
90
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/datasets/fairseqmmdataset.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ TODO (huxu): fairseq wrapper class for all dataset you defined: mostly MMDataset. """ from collections import OrderedDict from torch.util...
1,785
29.793103
85
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/datasets/mmdataset.py
# Copyright (c) Facebook, Inc. and 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 collections import OrderedDict from torch.utils.data import Dataset from torch.utils.data.dataloader import default_collat...
3,873
33.589286
76
py
rej-summ
rej-summ-main/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):...
23,125
37.802013
113
py
rej-summ
rej-summ-main/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...
32,302
35.377252
88
py
rej-summ
rej-summ-main/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 ...
9,358
33.032727
86
py
rej-summ
rej-summ-main/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, ...
29,891
34.208481
104
py
rej-summ
rej-summ-main/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...
12,416
35.845697
94
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/utils/__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 random import numpy as np import torch from .shardedtensor import * from .load_config import * def set_seed(seed=43211): random.s...
1,886
26.347826
77
py
rej-summ
rej-summ-main/examples/MMPT/mmpt/tasks/retritask.py
# Copyright (c) Facebook, Inc. and 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 torch import pickle import random from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.distrib...
8,413
32.125984
82
py