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
RepDistiller
RepDistiller-master/models/mobilenetv2.py
""" MobileNetV2 implementation used in <Knowledge Distillation via Route Constrained Optimization> """ import torch import torch.nn as nn import math __all__ = ['mobilenetv2_T_w', 'mobile_half'] BN = None def conv_bn(inp, oup, stride): return nn.Sequential( nn.Conv2d(inp, oup, 3, stride, 1, bias=False)...
5,705
27.108374
115
py
RepDistiller
RepDistiller-master/models/vgg.py
'''VGG for CIFAR10. FC layers are removed. (c) YANG, Wei ''' import torch.nn as nn import torch.nn.functional as F import math __all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19', ] model_urls = { 'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30...
6,971
28.417722
98
py
RepDistiller
RepDistiller-master/models/classifier.py
from __future__ import print_function import torch.nn as nn ######################################### # ===== Classifiers ===== # ######################################### class LinearClassifier(nn.Module): def __init__(self, dim_in, n_label=10): super(LinearClassifier, self).__init__() self.n...
819
21.777778
51
py
RepDistiller
RepDistiller-master/models/resnetv2.py
'''ResNet in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion...
6,915
33.753769
106
py
RepDistiller
RepDistiller-master/models/ShuffleNetv1.py
'''ShuffleNet in PyTorch. See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class ShuffleBlock(nn.Module): def __init__(self, groups): super(ShuffleBlock, self).__init_...
4,732
33.05036
126
py
RepDistiller
RepDistiller-master/models/util.py
from __future__ import print_function import torch.nn as nn import math class Paraphraser(nn.Module): """Paraphrasing Complex Network: Network Compression via Factor Transfer""" def __init__(self, t_shape, k=0.5, use_bn=False): super(Paraphraser, self).__init__() in_channel = t_shape[1] ...
9,622
32.068729
107
py
RepDistiller
RepDistiller-master/models/ShuffleNetv2.py
'''ShuffleNetV2 in PyTorch. See the paper "ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() ...
7,074
32.530806
107
py
RepDistiller
RepDistiller-master/models/wrn.py
import math import torch import torch.nn as nn import torch.nn.functional as F """ Original Author: Wei Yang """ __all__ = ['wrn'] class BasicBlock(nn.Module): def __init__(self, in_planes, out_planes, stride, dropRate=0.0): super(BasicBlock, self).__init__() self.bn1 = nn.BatchNorm2d(in_planes)...
5,519
31.280702
116
py
RepDistiller
RepDistiller-master/distiller_zoo/PKT.py
from __future__ import print_function import torch import torch.nn as nn class PKT(nn.Module): """Probabilistic Knowledge Transfer for deep representation learning Code from author: https://github.com/passalis/probabilistic_kt""" def __init__(self): super(PKT, self).__init__() def forward(se...
1,675
37.976744
110
py
RepDistiller
RepDistiller-master/distiller_zoo/SP.py
from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F class Similarity(nn.Module): """Similarity-Preserving Knowledge Distillation, ICCV2019, verified by original author""" def __init__(self): super(Similarity, self).__init__() def forward(self,...
908
28.322581
93
py
RepDistiller
RepDistiller-master/distiller_zoo/AT.py
from __future__ import print_function import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """Paying More Attention to Attention: Improving the Performance of Convolutional Neural Networks via Attention Transfer code: https://github.com/szagoruyko/attention-transfer""" de...
930
30.033333
101
py
RepDistiller
RepDistiller-master/distiller_zoo/FitNet.py
from __future__ import print_function import torch.nn as nn class HintLoss(nn.Module): """Fitnets: hints for thin deep nets, ICLR 2015""" def __init__(self): super(HintLoss, self).__init__() self.crit = nn.MSELoss() def forward(self, f_s, f_t): loss = self.crit(f_s, f_t) ...
332
21.2
54
py
RepDistiller
RepDistiller-master/distiller_zoo/KDSVD.py
from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F class KDSVD(nn.Module): """ Self-supervised Knowledge Distillation using Singular Value Decomposition original Tensorflow code: https://github.com/sseung0703/SSKD_SVD """ def __init__(self, k=...
2,275
28.947368
94
py
RepDistiller
RepDistiller-master/distiller_zoo/RKD.py
from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F class RKDLoss(nn.Module): """Relational Knowledge Disitllation, CVPR2019""" def __init__(self, w_d=25, w_a=50): super(RKDLoss, self).__init__() self.w_d = w_d self.w_a = w_a d...
1,681
27.508475
87
py
RepDistiller
RepDistiller-master/distiller_zoo/VID.py
from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class VIDLoss(nn.Module): """Variational Information Distillation for Knowledge Transfer (CVPR 2019), code from author: https://github.com/ssahn0215/variational-information-distillation...
1,862
32.872727
90
py
RepDistiller
RepDistiller-master/distiller_zoo/CC.py
from __future__ import print_function import torch import torch.nn as nn class Correlation(nn.Module): """Correlation Congruence for Knowledge Distillation, ICCV 2019. The authors nicely shared the code with me. I restructured their code to be compatible with my running framework. Credits go to the orig...
1,384
31.209302
81
py
RepDistiller
RepDistiller-master/distiller_zoo/FT.py
from __future__ import print_function import torch.nn as nn import torch.nn.functional as F class FactorTransfer(nn.Module): """Paraphrasing Complex Network: Network Compression via Factor Transfer, NeurIPS 2018""" def __init__(self, p1=2, p2=1): super(FactorTransfer, self).__init__() self.p1...
981
29.6875
93
py
RepDistiller
RepDistiller-master/distiller_zoo/KD.py
from __future__ import print_function import torch.nn as nn import torch.nn.functional as F class DistillKL(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super(DistillKL, self).__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_...
493
26.444444
82
py
RepDistiller
RepDistiller-master/distiller_zoo/AB.py
from __future__ import print_function import torch import torch.nn as nn class ABLoss(nn.Module): """Knowledge Transfer via Distillation of Activation Boundaries Formed by Hidden Neurons code: https://github.com/bhheo/AB_distillation """ def __init__(self, feat_num, margin=1.0): super(ABLoss,...
1,100
35.7
97
py
RepDistiller
RepDistiller-master/distiller_zoo/FSP.py
from __future__ import print_function import numpy as np import torch.nn as nn import torch.nn.functional as F class FSP(nn.Module): """A Gift from Knowledge Distillation: Fast Optimization, Network Minimization and Transfer Learning""" def __init__(self, s_shapes, t_shapes): super(FSP, self).__i...
1,625
32.183673
76
py
RepDistiller
RepDistiller-master/distiller_zoo/NST.py
from __future__ import print_function import torch.nn as nn import torch.nn.functional as F class NSTLoss(nn.Module): """like what you like: knowledge distill via neuron selectivity transfer""" def __init__(self): super(NSTLoss, self).__init__() pass def forward(self, g_s, g_t): ...
1,366
31.547619
98
py
RepDistiller
RepDistiller-master/helper/pretrain.py
from __future__ import print_function, division import time import sys import torch import torch.optim as optim import torch.backends.cudnn as cudnn from .util import AverageMeter def init(model_s, model_t, init_modules, criterion, train_loader, logger, opt): model_t.eval() model_s.eval() init_modules.tr...
3,376
34.547368
106
py
RepDistiller
RepDistiller-master/helper/loops.py
from __future__ import print_function, division import sys import time import torch from .util import AverageMeter, accuracy def train_vanilla(epoch, train_loader, model, criterion, optimizer, opt): """vanilla training""" model.train() batch_time = AverageMeter() data_time = AverageMeter() loss...
8,990
33.056818
85
py
RepDistiller
RepDistiller-master/helper/util.py
from __future__ import print_function import torch import numpy as np def adjust_learning_rate_new(epoch, optimizer, LUT): """ new learning rate schedule according to RotNet """ lr = next((lr for (max_epoch, lr) in LUT if max_epoch > epoch), LUT[-1][1]) for param_group in optimizer.param_groups: ...
1,707
26.111111
89
py
RepDistiller
RepDistiller-master/crd/memory.py
import torch from torch import nn import math class ContrastMemory(nn.Module): """ memory buffer that supplies large amount of negative samples. """ def __init__(self, inputSize, outputSize, K, T=0.07, momentum=0.5): super(ContrastMemory, self).__init__() self.nLem = outputSize ...
5,126
35.884892
120
py
RepDistiller
RepDistiller-master/crd/criterion.py
import torch from torch import nn from .memory import ContrastMemory eps = 1e-7 class CRDLoss(nn.Module): """CRD Loss function includes two symmetric parts: (a) using teacher as anchor, choose positive and negatives over the student side (b) using student as anchor, choose positive and negatives over...
3,309
31.135922
119
py
ConSERT
ConSERT-master/main.py
""" The system trains BERT (or any other transformer model like RoBERTa, DistilBERT etc.) on the SNLI + MultiNLI (AllNLI) dataset with softmax loss function. At every 1000 training steps, the model is evaluated on the STS benchmark dataset Usage: python training_nli.py --seed 1234 OR python training_nli.py --seed 123...
24,104
72.715596
1,210
py
ConSERT
ConSERT-master/correlation_visualization.py
import os import torch import matplotlib import argparse matplotlib.use("Agg") import matplotlib.pyplot as plt from sentence_transformers import SentenceTransformer, util from data_utils import load_datasets, load_chinese_tsv_data def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--mo...
3,587
38.428571
117
py
ConSERT
ConSERT-master/transformers/modeling_encoder_decoder.py
# coding=utf-8 # Copyright 2018 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 applicable...
24,460
52.176087
420
py
ConSERT
ConSERT-master/transformers/modeling_longformer.py
# coding=utf-8 # Copyright 2020 The Allen Institute for AI team and 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...
80,996
43.503846
222
py
ConSERT
ConSERT-master/transformers/convert_mbart_original_checkpoint_to_pytorch.py
import argparse import torch from transformers import BartForConditionalGeneration, MBartConfig from .convert_bart_original_pytorch_checkpoint_to_pytorch import remove_ignore_keys_ def convert_fairseq_mbart_checkpoint_from_disk(checkpoint_path, hf_config_path="facebook/mbart-large-en-ro"): state_dict = torch.l...
1,489
39.27027
117
py
ConSERT
ConSERT-master/transformers/convert_pegasus_tf_to_pytorch.py
# coding=utf-8 # Copyright 2020 Google and 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...
5,347
39.210526
113
py
ConSERT
ConSERT-master/transformers/modeling_tf_albert.py
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
55,170
41.37404
160
py
ConSERT
ConSERT-master/transformers/optimization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and 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/LICEN...
22,600
41.483083
142
py
ConSERT
ConSERT-master/transformers/modeling_mmbt.py
# coding=utf-8 # Copyright (c) Facebook, Inc. and its affiliates. # Copyright (c) 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...
19,377
45.806763
134
py
ConSERT
ConSERT-master/transformers/modeling_marian.py
# coding=utf-8 # Copyright 2020 Marian Team Authors and 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 # # Unles...
2,432
42.446429
115
py
ConSERT
ConSERT-master/transformers/tokenization_dpr.py
# coding=utf-8 # Copyright 2018 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 applicable...
19,909
50.580311
152
py
ConSERT
ConSERT-master/transformers/configuration_utils.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...
28,627
51.916821
277
py
ConSERT
ConSERT-master/transformers/convert_longformer_original_pytorch_lightning_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
3,037
33.91954
117
py
ConSERT
ConSERT-master/transformers/optimization_tf.py
# Copyright 2019 The TensorFlow Authors. 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
15,876
43.977337
126
py
ConSERT
ConSERT-master/transformers/modeling_tf_pytorch_utils.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...
16,828
41.821883
151
py
ConSERT
ConSERT-master/transformers/modeling_distilbert.py
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, 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.or...
38,980
39.775105
140
py
ConSERT
ConSERT-master/transformers/modeling_layoutlm.py
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors and 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/...
37,078
40.475391
164
py
ConSERT
ConSERT-master/transformers/modeling_tf_xlm_roberta.py
# coding=utf-8 # Copyright 2019 Facebook AI Research 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 copy of the Licens...
6,300
40.183007
226
py
ConSERT
ConSERT-master/transformers/modeling_tf_gpt2.py
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
35,990
43.488257
164
py
ConSERT
ConSERT-master/transformers/modeling_tf_transfo_xl.py
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice...
39,355
40.253669
160
py
ConSERT
ConSERT-master/transformers/convert_blenderbot_original_pytorch_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2020 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 applicable...
3,678
30.991304
111
py
ConSERT
ConSERT-master/transformers/modeling_tf_t5.py
# coding=utf-8 # Copyright 2018 T5 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 copy of the License at # # ...
66,954
45.33564
205
py
ConSERT
ConSERT-master/transformers/modeling_tf_auto.py
# coding=utf-8 # Copyright 2018 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 applicable...
63,058
44.398848
142
py
ConSERT
ConSERT-master/transformers/modeling_outputs.py
from dataclasses import dataclass from typing import List, Optional, Tuple import torch from .file_utils import ModelOutput @dataclass class BaseModelOutput(ModelOutput): """ Base class for model's outputs, with potential hidden states and attentions. Args: last_hidden_state (:obj:`torch.FloatT...
36,756
61.089527
176
py
ConSERT
ConSERT-master/transformers/modeling_flax_auto.py
# coding=utf-8 # Copyright 2018 The Google Flax Team Authors and 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 ...
8,917
52.083333
396
py
ConSERT
ConSERT-master/transformers/modeling_utils.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...
82,105
47.383029
197
py
ConSERT
ConSERT-master/transformers/modeling_tf_openai.py
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
32,481
44.113889
164
py
ConSERT
ConSERT-master/transformers/testing_utils.py
import inspect import logging import os import re import shutil import sys import tempfile import unittest from distutils.util import strtobool from io import StringIO from pathlib import Path from .file_utils import ( _datasets_available, _faiss_available, _flax_available, _sentencepiece_available, ...
14,949
28.371316
106
py
ConSERT
ConSERT-master/transformers/modeling_tf_flaubert.py
# coding=utf-8 # Copyright 2019-present, Facebook, Inc and 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 # # Un...
35,507
43.890013
160
py
ConSERT
ConSERT-master/transformers/modeling_bert.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...
75,401
40.913285
219
py
ConSERT
ConSERT-master/transformers/training_args_tf.py
import warnings from dataclasses import dataclass, field from typing import Tuple from .file_utils import cached_property, is_tf_available, tf_required from .training_args import TrainingArguments from .utils import logging logger = logging.get_logger(__name__) if is_tf_available(): import tensorflow as tf @d...
10,654
46.566964
119
py
ConSERT
ConSERT-master/transformers/convert_graph_to_onnx.py
from argparse import ArgumentParser from os import listdir, makedirs from pathlib import Path from typing import Dict, List, Optional, Tuple from packaging.version import Version, parse from transformers import is_tf_available, is_torch_available from transformers.file_utils import ModelOutput from transformers.pipel...
17,899
36.447699
121
py
ConSERT
ConSERT-master/transformers/modeling_gpt2.py
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
46,472
42.030556
180
py
ConSERT
ConSERT-master/transformers/modeling_flaubert.py
# coding=utf-8 # Copyright 2019-present CNRS, Facebook Inc. and 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 #...
17,452
40.35782
138
py
ConSERT
ConSERT-master/transformers/tokenization_utils_base.py
# coding=utf-8 # Copyright 2020 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 applicable...
143,797
47.416835
252
py
ConSERT
ConSERT-master/transformers/convert_albert_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
2,176
34.112903
117
py
ConSERT
ConSERT-master/transformers/modeling_openai.py
# coding=utf-8 # Copyright 2018 The OpenAI Team Authors and 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 copy of the License...
36,008
41.614201
168
py
ConSERT
ConSERT-master/transformers/convert_t5_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 The T5 authors 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 require...
2,113
33.096774
117
py
ConSERT
ConSERT-master/transformers/pipelines.py
# coding=utf-8 # Copyright 2018 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 applicable...
118,659
41.591529
183
py
ConSERT
ConSERT-master/transformers/modeling_tf_mobilebert.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...
66,041
41.635249
160
py
ConSERT
ConSERT-master/transformers/convert_tf_hub_seq_to_seq_bert_to_pytorch.py
# coding=utf-8 # Copyright 2020 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 applicable...
2,931
31.94382
119
py
ConSERT
ConSERT-master/transformers/convert_gpt2_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
2,520
36.073529
119
py
ConSERT
ConSERT-master/transformers/modeling_rag.py
# coding=utf-8 # Copyright 2020, The RAG Authors and 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 r...
79,283
51.680399
204
py
ConSERT
ConSERT-master/transformers/modeling_squeezebert.py
# coding=utf-8 # Copyright 2020 The SqueezeBert authors and 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 # # U...
41,618
39.211594
126
py
ConSERT
ConSERT-master/transformers/modeling_tf_roberta.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...
52,114
40.92679
222
py
ConSERT
ConSERT-master/transformers/convert_electra_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
2,866
34.8375
117
py
ConSERT
ConSERT-master/transformers/trainer_callback.py
# coding=utf-8 # Copyright 2020-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 ap...
19,461
40.408511
119
py
ConSERT
ConSERT-master/transformers/modeling_electra.py
# coding=utf-8 # Copyright 2019 The Google AI Language Team Authors and 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/LICEN...
53,903
39.898331
168
py
ConSERT
ConSERT-master/transformers/trainer_pt_utils.py
# coding=utf-8 # Copyright 2020-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 ap...
12,036
39.392617
119
py
ConSERT
ConSERT-master/transformers/convert_roberta_original_pytorch_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
7,974
45.098266
117
py
ConSERT
ConSERT-master/transformers/convert_bert_original_tf2_checkpoint_to_pytorch.py
""" This script can be used to convert a head-less TF2.x Bert model to PyTorch, as published on the official GitHub: https://github.com/tensorflow/models/tree/master/official/nlp/bert TF2.x uses different variable names from the original BERT (TF 1.4) implementation. The script re-maps the TF2.x Bert weight names to t...
9,664
41.577093
131
py
ConSERT
ConSERT-master/transformers/tokenization_bert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and 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/LICEN...
24,880
43.509839
183
py
ConSERT
ConSERT-master/transformers/activations_tf.py
import math import tensorflow as tf def gelu(x): """Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when initially created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + t...
1,924
28.166667
115
py
ConSERT
ConSERT-master/transformers/modeling_fsmt.py
# coding=utf-8 # Copyright 2020 The Facebook AI Research Team Authors and 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/LIC...
49,644
39.39463
270
py
ConSERT
ConSERT-master/transformers/convert_transfo_xl_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
4,926
38.103175
121
py
ConSERT
ConSERT-master/transformers/retrieval_rag.py
# coding=utf-8 # Copyright 2020, The RAG Authors and 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 r...
27,944
44.36526
170
py
ConSERT
ConSERT-master/transformers/convert_mobilebert_original_tf_checkpoint_to_pytorch.py
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, mobilebert_config_file, pytorch_dump_path): # Initialise ...
1,586
35.906977
117
py
ConSERT
ConSERT-master/transformers/modeling_tf_transfo_xl_utilities.py
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice...
7,818
41.494565
118
py
ConSERT
ConSERT-master/transformers/modeling_flax_bert.py
# coding=utf-8 # Copyright 2018 The Google Flax Team Authors and 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 ...
16,952
37.617312
120
py
ConSERT
ConSERT-master/transformers/generation_tf_utils.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...
54,719
48.836066
246
py
ConSERT
ConSERT-master/transformers/trainer_tf.py
"""Tensorflow trainer class.""" import datetime import math import os import warnings from typing import Callable, Dict, Optional, Tuple import numpy as np import tensorflow as tf from packaging.version import parse from tensorflow.python.distribute.values import PerReplica from .integrations import is_comet_availab...
34,714
42.887484
169
py
ConSERT
ConSERT-master/transformers/modeling_auto.py
# coding=utf-8 # Copyright 2018 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 applicable...
67,297
43.129836
147
py
ConSERT
ConSERT-master/transformers/convert_bart_original_pytorch_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2020 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 applicable...
5,484
37.090278
117
py
ConSERT
ConSERT-master/transformers/modeling_bert_generation.py
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors and 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/LICEN...
23,694
44.39272
145
py
ConSERT
ConSERT-master/transformers/modeling_funnel.py
# coding=utf-8 # Copyright 2020-present Google Brain and Carnegie Mellon University Authors and 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.a...
65,709
41.284427
168
py
ConSERT
ConSERT-master/transformers/modeling_t5.py
# coding=utf-8 # Copyright 2018 Mesh TensorFlow authors, T5 Authors 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...
56,316
43.032056
213
py
ConSERT
ConSERT-master/transformers/modeling_tf_electra.py
import warnings from dataclasses import dataclass from typing import Optional, Tuple import tensorflow as tf from .activations_tf import get_tf_activation from .configuration_electra import ElectraConfig from .file_utils import ( MULTIPLE_CHOICE_DUMMY_INPUTS, ModelOutput, add_code_sample_docstrings, a...
56,073
40.752792
160
py
ConSERT
ConSERT-master/transformers/modeling_tf_xlnet.py
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University 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 Lice...
82,670
43.978781
171
py
ConSERT
ConSERT-master/transformers/modeling_tf_lxmert.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors, The HuggingFace Inc. team, and the # Lxmert Authors. # 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....
61,940
44.048
169
py
ConSERT
ConSERT-master/transformers/convert_funnel_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2020 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 applicable...
2,128
33.33871
117
py
ConSERT
ConSERT-master/transformers/convert_marian_to_pytorch.py
import argparse import json import os import socket import time import warnings from pathlib import Path from typing import Dict, List, Union from zipfile import ZipFile import numpy as np import torch from tqdm import tqdm from transformers import MarianConfig, MarianMTModel, MarianTokenizer from transformers.hf_api...
22,823
35.991896
116
py
ConSERT
ConSERT-master/transformers/convert_marian_tatoeba_to_pytorch.py
import argparse import os from pathlib import Path from typing import List, Tuple from transformers.convert_marian_to_pytorch import ( FRONT_MATTER_TEMPLATE, _parse_readme, convert_all_sentencepiece_models, get_system_metadata, remove_prefix, remove_suffix, ) try: import pandas as pd exce...
33,227
25.5824
175
py
ConSERT
ConSERT-master/transformers/convert_openai_original_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 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 applicable...
2,654
34.878378
118
py
ConSERT
ConSERT-master/transformers/training_args.py
import dataclasses import json import os import warnings from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional, Tuple from .file_utils import cached_property, is_torch_available, is_torch_tpu_available, torch_required from .trainer_utils import EvaluationStrategy f...
22,646
48.019481
142
py