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
neurips-attention
neurips-attention-master/baseline_cnns/pytorch-cnn-visualizations-modified/src/scorecam.py
""" Created on Wed Apr 29 16:11:20 2020 @author: Haofan Wang - github.com/haofanwang """ from PIL import Image import numpy as np import torch import torch.nn.functional as F from misc_functions import get_example_params, save_class_activation_images class CamExtractor(): """ Extracts cam features from ...
3,920
36.701923
120
py
neurips-attention
neurips-attention-master/baseline_cnns/pytorch-cnn-visualizations-modified/src/deep_dream.py
""" Created on Mon Nov 21 21:57:29 2017 @author: Utku Ozbulak - github.com/utkuozbulak """ import os from PIL import Image import torch from torch.optim import SGD from torchvision import models from misc_functions import preprocess_image, recreate_image, save_image class DeepDream(): """ Produces an i...
3,588
38.01087
95
py
AS-MAML
AS-MAML-master/main.py
import argparse from data.dataset1 import GraphDataSet,FewShotDataloader from models.meta_ada import Meta from tqdm import tqdm from tensorboardX import SummaryWriter from utils import * setup_seed() def get_dataset(dataset): val_data = GraphDataSet(phase="val", dataset_name=dataset) train_data=GraphDataSet...
8,269
41.193878
130
py
AS-MAML
AS-MAML-master/test.py
import argparse import time import torch from models.sage4maml_model import Model import ssl import os from data.dataset1 import GraphDataSet,FewShotDataloader from models.meta_ada import Meta from tqdm import tqdm import numpy as np from utils import * def get_dataset(dataset): train_data=None val_data=None ...
3,671
36.090909
120
py
AS-MAML
AS-MAML-master/sparse_softmax.py
""" An original implementation of sparsemax (Martins & Astudillo, 2016) is available at https://github.com/OpenNMT/OpenNMT-py/blob/master/onmt/modules/sparse_activations.py. See `From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification, ICML 2016` for detailed description. We make some mod...
4,580
32.195652
118
py
AS-MAML
AS-MAML-master/utils.py
import os import time import torch import numpy as np import json import _pickle import math def get_para_num(net): total_num = sum(p.numel() for p in net.parameters()) trainable_num = sum(p.numel() for p in net.parameters() if p.requires_grad) return {'Total': total_num, 'Trainable': trainable_num} def ...
3,047
26.963303
85
py
AS-MAML
AS-MAML-master/models/meta_ada.py
import torch from torch import nn from torch.nn import functional as F from torch import optim import numpy as np import math import random # from tensorboardX import SummaryWriter class Meta(nn.Module): """ Meta Learner """ class StopControl(nn.Module): def __init__(self, input_si...
16,736
42.814136
141
py
AS-MAML
AS-MAML-master/models/sag_poolfw.py
import torch from models.graph_convfw import GraphConv from torch_geometric.nn.pool.topk_pool import topk, filter_adj from torch_geometric.utils import softmax class SAGPooling(torch.nn.Module): r"""The self-attention pooling operator from the `"Self-Attention Graph Pooling" <https://arxiv.org/abs/1904.08082>`...
4,586
39.59292
79
py
AS-MAML
AS-MAML-master/models/graph_convfw.py
import torch from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from models.layersFw import LinearFw from utils import uniform class GraphConv(MessagePassing): r"""The graph neural network operator from the `"Weisfeiler and Leman Go Neural: Higher-order Graph Neural Networks" ...
2,551
34.444444
79
py
AS-MAML
AS-MAML-master/models/sage4maml_model.py
import torch import torch.nn.functional as F from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # from models.TopKPoolfw import TopKPooling # from torch_geometric.nn import GCNConv from models.sage_conv_fw import SAGEConv from models.sag_poolfw import SAGPooling from models.layersFw import L...
6,791
43.392157
114
py
AS-MAML
AS-MAML-master/models/sage_conv_fw.py
import torch import torch.nn.functional as F from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.utils import add_remaining_self_loops from utils import uniform class SAGEConv(MessagePassing): r"""The GraphSAGE operator from the `"Inductive Representation Learni...
3,210
34.677778
79
py
AS-MAML
AS-MAML-master/models/TopKPoolfw.py
import torch from torch.nn import Parameter from torch_scatter import scatter_add, scatter_max from torch_geometric.utils import softmax import math # from ..inits import uniform # from ...utils.num_nodes import maybe_num_nodes def maybe_num_nodes(index, num_nodes=None): return index.max().item() + 1 if num_nodes ...
6,515
35.2
85
py
AS-MAML
AS-MAML-master/models/meta.py
import torch from torch import nn from torch import optim from torch.nn import functional as F from torch.utils.data import TensorDataset, DataLoader from torch import optim import numpy as np from copy import deepcopy class Meta(nn.Module): """ Meta Learner """ def __init__(self,mo...
8,225
38.73913
141
py
AS-MAML
AS-MAML-master/models/GcnConv.py
import torch from torch.nn import Parameter from torch_scatter import scatter_add from torch_geometric.nn.conv import MessagePassing from torch_geometric.utils import add_remaining_self_loops import math # from ..inits import glorot, zeros class GCNConvFw(MessagePassing): r"""The graph convolutional operator from...
5,153
36.620438
79
py
AS-MAML
AS-MAML-master/models/layersFw.py
import torch import torch.nn as nn import torch.nn.functional as F from sparse_softmax import Sparsemax from torch.nn import Parameter from torch_geometric.data import Data from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.pool.topk_pool import topk, filter_adj from torch_geometric.utils import...
12,080
40.515464
123
py
AS-MAML
AS-MAML-master/models/GCN4maml.py
import torch import torch.nn.functional as F from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp from models.TopKPoolfw import TopKPooling from models.GcnConv import GCNConvFw from models.layersFw import LinearFw from torch_geometric.nn.conv import MessagePassing from torch_geometric.utils im...
5,510
41.068702
114
py
AS-MAML
AS-MAML-master/data/dataset1.py
import os import os.path as osp import shutil import pickle import torch.utils.data as data import numpy as np import torch import random import torchvision import torchvision.datasets as datasets import torchvision.transforms as transforms import torchnet as tnt import gl #globle variables class GraphDataSet(data.Dat...
7,458
35.208738
159
py
Wav2Lip
Wav2Lip-master/inference.py
from os import listdir, path import numpy as np import scipy, cv2, os, sys, argparse, audio import json, subprocess, random, string from tqdm import tqdm from glob import glob import torch, face_detection from models import Wav2Lip import platform parser = argparse.ArgumentParser(description='Inference code to lip-syn...
9,750
33.701068
116
py
Wav2Lip
Wav2Lip-master/hq_wav2lip_train.py
from os.path import dirname, join, basename, isfile from tqdm import tqdm from models import SyncNet_color as SyncNet from models import Wav2Lip, Wav2Lip_disc_qual import audio import torch from torch import nn from torch.nn import functional as F from torch import optim import torch.backends.cudnn as cudnn from torc...
16,726
36.673423
132
py
Wav2Lip
Wav2Lip-master/color_syncnet_train.py
from os.path import dirname, join, basename, isfile from tqdm import tqdm from models import SyncNet_color as SyncNet import audio import torch from torch import nn from torch import optim import torch.backends.cudnn as cudnn from torch.utils import data as data_utils import numpy as np from glob import glob import...
8,771
30.328571
108
py
Wav2Lip
Wav2Lip-master/wav2lip_train.py
from os.path import dirname, join, basename, isfile from tqdm import tqdm from models import SyncNet_color as SyncNet from models import Wav2Lip as Wav2Lip import audio import torch from torch import nn from torch import optim import torch.backends.cudnn as cudnn from torch.utils import data as data_utils import nump...
12,918
33.450667
123
py
Wav2Lip
Wav2Lip-master/evaluation/real_videos_inference.py
from os import listdir, path import numpy as np import scipy, cv2, os, sys, argparse import dlib, json, subprocess from tqdm import tqdm from glob import glob import torch sys.path.append('../') import audio import face_detection from models import Wav2Lip parser = argparse.ArgumentParser(description='Code to generat...
9,173
28.980392
113
py
Wav2Lip
Wav2Lip-master/evaluation/gen_videos_from_filelist.py
from os import listdir, path import numpy as np import scipy, cv2, os, sys, argparse import dlib, json, subprocess from tqdm import tqdm from glob import glob import torch sys.path.append('../') import audio import face_detection from models import Wav2Lip parser = argparse.ArgumentParser(description='Code to generat...
7,204
29.146444
109
py
Wav2Lip
Wav2Lip-master/evaluation/scores_LSE/SyncNetInstance_calc_scores.py
#!/usr/bin/python #-*- coding: utf-8 -*- # Video 25 FPS, Audio 16000HZ import torch import numpy import time, pdb, argparse, subprocess, os, math, glob import cv2 import python_speech_features from scipy import signal from scipy.io import wavfile from SyncNetModel import * from shutil import rmtree # ==============...
6,801
31.236967
170
py
Wav2Lip
Wav2Lip-master/models/wav2lip.py
import torch from torch import nn from torch.nn import functional as F import math from .conv import Conv2dTranspose, Conv2d, nonorm_Conv2d class Wav2Lip(nn.Module): def __init__(self): super(Wav2Lip, self).__init__() self.face_encoder_blocks = nn.ModuleList([ nn.Sequential(Conv2d(6, ...
8,579
45.378378
111
py
Wav2Lip
Wav2Lip-master/models/conv.py
import torch from torch import nn from torch.nn import functional as F class Conv2d(nn.Module): def __init__(self, cin, cout, kernel_size, stride, padding, residual=False, *args, **kwargs): super().__init__(*args, **kwargs) self.conv_block = nn.Sequential( nn.Conv2d(cin,...
1,620
35.022222
104
py
Wav2Lip
Wav2Lip-master/models/syncnet.py
import torch from torch import nn from torch.nn import functional as F from .conv import Conv2d class SyncNet_color(nn.Module): def __init__(self): super(SyncNet_color, self).__init__() self.face_encoder = nn.Sequential( Conv2d(15, 32, kernel_size=(7, 7), stride=1, padding=3), ...
3,141
45.895522
88
py
Wav2Lip
Wav2Lip-master/face_detection/utils.py
from __future__ import print_function import os import sys import time import torch import math import numpy as np import cv2 def _gaussian( size=3, sigma=0.25, amplitude=1, normalize=False, width=None, height=None, sigma_horz=None, sigma_vert=None, mean_horz=0.5, mean_vert=0.5): # handle ...
11,808
36.60828
111
py
Wav2Lip
Wav2Lip-master/face_detection/api.py
from __future__ import print_function import os import torch from torch.utils.model_zoo import load_url from enum import Enum import numpy as np import cv2 try: import urllib.request as request_file except BaseException: import urllib as request_file from .models import FAN, ResNetDepth from .utils import * ...
2,266
27.696203
113
py
Wav2Lip
Wav2Lip-master/face_detection/models.py
import torch import torch.nn as nn import torch.nn.functional as F import math def conv3x3(in_planes, out_planes, strd=1, padding=1, bias=False): "3x3 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=strd, padding=padding, bias=bias) class ConvBloc...
8,619
31.900763
106
py
Wav2Lip
Wav2Lip-master/face_detection/detection/core.py
import logging import glob from tqdm import tqdm import numpy as np import torch import cv2 class FaceDetector(object): """An abstract class representing a face detector. Any other face detection implementation must subclass it. All subclasses must implement ``detect_from_image``, that return a list of d...
4,868
36.167939
112
py
Wav2Lip
Wav2Lip-master/face_detection/detection/sfd/detect.py
import torch import torch.nn.functional as F import os import sys import cv2 import random import datetime import math import argparse import numpy as np import scipy.io as sio import zipfile from .net_s3fd import s3fd from .bbox import * def detect(net, img, device): img = img - np.array([104, 117, 123]) i...
3,769
32.362832
109
py
Wav2Lip
Wav2Lip-master/face_detection/detection/sfd/sfd_detector.py
import os import cv2 from torch.utils.model_zoo import load_url from ..core import FaceDetector from .net_s3fd import s3fd from .bbox import * from .detect import * models_urls = { 's3fd': 'https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth', } class SFDDetector(FaceDetector): def __init_...
1,809
29.166667
133
py
Wav2Lip
Wav2Lip-master/face_detection/detection/sfd/bbox.py
from __future__ import print_function import os import sys import cv2 import random import datetime import time import math import argparse import numpy as np import torch try: from iou import IOU except BaseException: # IOU cython speedup 10x def IOU(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2): sa = a...
4,279
31.923077
87
py
Wav2Lip
Wav2Lip-master/face_detection/detection/sfd/net_s3fd.py
import torch import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): def __init__(self, n_channels, scale=1.0): super(L2Norm, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(sel...
5,291
39.707692
91
py
ACDnet
ACDnet-master/network_related/vgg16_reduced.py
##### # This code is largely referred from MXNet's SSD implementation ##### import mxnet as mx def get_symbol(data, num_classes=1000, **kwargs): """ VGG 16 layers network This is a modified version, with fc6/fc7 layers replaced by conv layers And the network is slightly smaller than original VGG 16 ne...
4,558
46.989474
84
py
ACDnet
ACDnet-master/network_related/common.py
##### # This code is largely referred from MXNet's SSD implementation ##### import mxnet as mx import numpy as np def conv_act_layer_norelu(from_layer, name, num_filter, kernel=(1,1), pad=(0,0), \ stride=(1,1), act_type="relu", use_batchnorm=False): # use_batchnorm=False conv = mx.symbol.Convolution(dat...
13,102
40.596825
113
py
ACDnet
ACDnet-master/network_related/symbol_builder.py
import mxnet as mx from symbol_.common import multi_layer_feature, multibox_layer import numpy as np def import_module(module_name): """Helper function to import module""" import sys, os import importlib sys.path.append(os.path.dirname(__file__)) return importlib.import_module(module_name) #####...
32,850
53.120264
205
py
cgcnn
cgcnn-master/main.py
import argparse import os import shutil import sys import time import warnings from random import sample import numpy as np import torch import torch.nn as nn import torch.optim as optim from sklearn import metrics from torch.autograd import Variable from torch.optim.lr_scheduler import MultiStepLR from cgcnn.data im...
20,707
39.287938
95
py
cgcnn
cgcnn-master/predict.py
import argparse import os import shutil import sys import time import numpy as np import torch import torch.nn as nn from sklearn import metrics from torch.autograd import Variable from torch.utils.data import DataLoader from cgcnn.data import CIFData from cgcnn.data import collate_pool from cgcnn.model import Crysta...
11,219
36.4
89
py
cgcnn
cgcnn-master/cgcnn/model.py
from __future__ import print_function, division import torch import torch.nn as nn class ConvLayer(nn.Module): """ Convolutional operation on graphs """ def __init__(self, atom_fea_len, nbr_fea_len): """ Initialize ConvLayer. Parameters ---------- atom_fea_le...
6,655
34.404255
76
py
cgcnn
cgcnn-master/cgcnn/data.py
from __future__ import print_function, division import csv import functools import json import os import random import warnings import numpy as np import torch from pymatgen.core.structure import Structure from torch.utils.data import Dataset, DataLoader from torch.utils.data.dataloader import default_collate from to...
12,678
34.917847
79
py
SAPar
SAPar-master/SAPar_model.py
import numpy as np import torch import torch.nn as nn import torch.nn.init as init use_cuda = torch.cuda.is_available() if use_cuda: torch_t = torch.cuda def from_numpy(ndarray): return torch.from_numpy(ndarray).pin_memory().cuda(async=True) else: print("Not using CUDA!") torch_t = torch fr...
77,290
43.242129
166
py
SAPar
SAPar-master/SAPar_main.py
import argparse import itertools import os.path import os import time import logging import datetime import torch import torch.optim.lr_scheduler import numpy as np import os import evaluate import trees import vocabulary import nkutil from tqdm import tqdm import SAPar_model import random tokens = SAPar_model from ...
23,798
37.139423
111
py
SAPar
SAPar-master/pytorch_pretrained_zen/optimization.py
# coding=utf-8 # This file is derived from the code at # https://github.com/huggingface/transformers/blob/master/transformers/optimization.py # # Original copyright notice: # # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "Lice...
13,252
40.939873
139
py
SAPar
SAPar-master/pytorch_pretrained_zen/tokenization.py
# coding=utf-8 # This file is derived from the code at # https://github.com/huggingface/transformers/blob/master/transformers/tokenization_bert.py # # Original copyright notice: # # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the ...
18,788
41.89726
179
py
SAPar
SAPar-master/pytorch_pretrained_zen/modeling.py
# coding: utf-8 # Copyright 2019 Sinovation Ventures AI Institute # # 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 app...
70,545
50.948454
187
py
SAPar
SAPar-master/pytorch_pretrained_zen/file_utils.py
# This file is derived from the code at # https://github.com/huggingface/transformers/blob/master/transformers/file_utils.py # and the code at # https://github.com/allenai/allennlp/blob/master/allennlp/common/file_utils.py. # # Original copyright notice: # # This file is adapted from the AllenNLP library at https://git...
9,610
32.371528
98
py
SAPar
SAPar-master/pytorch_pretrained_bert/optimization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace 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/LICENS...
6,803
40.742331
116
py
SAPar
SAPar-master/pytorch_pretrained_bert/__main__.py
# coding: utf8 def main(): import sys try: from .convert_tf_checkpoint_to_pytorch import convert_tf_checkpoint_to_pytorch except ModuleNotFoundError: print("pytorch_pretrained_bert can only be used from the commandline to convert TensorFlow models in PyTorch, " "In that case, i...
932
39.565217
137
py
SAPar
SAPar-master/pytorch_pretrained_bert/modeling.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace 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...
57,606
48.704055
139
py
SAPar
SAPar-master/pytorch_pretrained_bert/file_utils.py
""" Utilities for working with the local dataset cache. This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp Copyright by the AllenNLP authors. """ import os import logging import shutil import tempfile import json from urllib.parse import urlparse from pathlib import Path from typing ...
8,021
32.425
98
py
SAPar
SAPar-master/pytorch_pretrained_bert/convert_tf_checkpoint_to_pytorch.py
# coding=utf-8 # Copyright 2018 The HugginFace 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,477
38.628319
101
py
SAPar
SAPar-master/pytorch_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...
8,635
44.452632
130
py
SAPar
SAPar-master/pytorch_transformers/__main__.py
# coding: utf8 def main(): import sys if (len(sys.argv) < 4 or len(sys.argv) > 6) or sys.argv[1] not in ["bert", "gpt", "transfo_xl", "gpt2", "xlnet", "xlm"]: print( "Should be used as one of: \n" ">> pytorch_transformers bert TF_CHECKPOINT TF_CONFIG PYTORCH_DUMP_OUTPUT, \n" ">> ...
7,021
53.434109
143
py
SAPar
SAPar-master/pytorch_transformers/convert_gpt2_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...
3,081
39.552632
111
py
SAPar
SAPar-master/pytorch_transformers/convert_openai_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...
3,170
40.723684
118
py
SAPar
SAPar-master/pytorch_transformers/modeling_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...
47,379
50.668484
480
py
SAPar
SAPar-master/pytorch_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...
66,519
52.601934
187
py
SAPar
SAPar-master/pytorch_transformers/tokenization_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...
5,711
52.886792
153
py
SAPar
SAPar-master/pytorch_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...
36,429
48.699864
136
py
SAPar
SAPar-master/pytorch_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...
34,785
47.516039
140
py
SAPar
SAPar-master/pytorch_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...
20,131
43.441501
183
py
SAPar
SAPar-master/pytorch_transformers/convert_xlnet_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,357
40.504762
126
py
SAPar
SAPar-master/pytorch_transformers/convert_xlm_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,955
37.894737
117
py
SAPar
SAPar-master/pytorch_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...
15,108
60.418699
158
py
SAPar
SAPar-master/pytorch_transformers/convert_transfo_xl_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...
5,555
46.084746
121
py
SAPar
SAPar-master/pytorch_transformers/convert_roberta_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...
8,720
46.917582
188
py
SAPar
SAPar-master/pytorch_transformers/file_utils.py
""" Utilities for working with the local dataset cache. This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp Copyright by the AllenNLP authors. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import sys import json import logging import os impor...
9,100
33.604563
112
py
SAPar
SAPar-master/pytorch_transformers/convert_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,599
38.393939
102
py
SAPar
SAPar-master/pytorch_transformers/modeling_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...
58,525
41.782164
157
py
SAPar
SAPar-master/pytorch_transformers/modeling_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...
63,587
48.484825
169
py
SAPar
SAPar-master/pytorch_transformers/modeling_xlm.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...
44,843
47.956332
151
py
SAPar
SAPar-master/pytorch_transformers/tokenization_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...
21,459
36.583187
110
py
SAPar
SAPar-master/pytorch_transformers/convert_pytorch_checkpoint_to_tf.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,495
33.320611
115
py
SAPar
SAPar-master/pytorch_transformers/modeling_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...
13,568
39.747748
132
py
SAPar
SAPar-master/pytorch_transformers/modeling_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...
18,024
50.5
134
py
SAPar
SAPar-master/pytorch_transformers/tokenization_utils.py
# coding=utf-8 # Copyright 2018 The Open AI 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 # # ...
31,331
46.762195
380
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_transfo_xl_test.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,536
38.706977
93
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_transfo_xl_test.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 ...
2,677
35.189189
94
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_openai_test.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 ...
2,001
39.857143
122
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_roberta_test.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 ...
10,235
41.123457
120
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_utils_test.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...
1,838
38.12766
77
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_common_test.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...
26,105
43.702055
138
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_xlm_test.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,181
37.337349
94
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_auto_test.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,782
36.145833
97
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_bert_test.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,581
45.587859
162
py
SAPar
SAPar-master/pytorch_transformers/tests/optimization_test.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,088
42.492857
115
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_xlnet_test.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,185
42.919505
135
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_bert_test.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 ...
5,280
36.190141
90
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_auto_test.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,825
37.851064
91
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_roberta_test.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,782
38.40625
121
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_xlnet_test.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 ...
5,242
48
128
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_xlm_test.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,674
42.112245
171
py
SAPar
SAPar-master/pytorch_transformers/tests/modeling_gpt2_test.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,934
38.489796
112
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_gpt2_test.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 ...
2,656
36.957143
95
py
SAPar
SAPar-master/pytorch_transformers/tests/tokenization_openai_test.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 ...
2,636
35.123288
90
py
finn-examples
finn-examples-main/build/cybersecurity-mlp/custom_steps.py
import numpy as np import pkg_resources as pk import os from brevitas.nn import QuantLinear, QuantReLU, QuantIdentity import torch import torch.nn as nn import brevitas.onnx as bo from brevitas.quant_tensor import QuantTensor # Define export wrapper class CybSecMLPForExport(nn.Module): def __init__(self, my_pretr...
3,178
33.182796
89
py
PersianQA
PersianQA-main/src/utils.py
# ----------------------------------------------------------------------- PyTorch Section from tqdm import tqdm import torch class AnswerPredictor: def __init__(self, model, tokenizer, device='cuda', n_best=10, max_length=512, stride=256, no_answer=False): """Initializes PyTorch Question Answering Predictio...
9,375
44.736585
121
py
easy_pbr
easy_pbr-master/setup.py
import os import re import sys import platform import subprocess import glob from setuptools import setup, Extension from setuptools.command.build_ext import build_ext from distutils.version import LooseVersion from distutils.command.install_headers import install_headers as install_headers_orig from setuptools import...
11,455
34.033639
215
py