repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
EDGY
EDGY-master/Training/VQ-VAE/Preprocessing/preprocess.py
import hydra from hydra import utils from pathlib import Path import librosa import scipy import json import numpy as np from multiprocessing import cpu_count from concurrent.futures import ProcessPoolExecutor from functools import partial from tqdm import tqdm def preemphasis(x, preemph): return scipy.signal.lfi...
3,174
35.918605
99
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/incremental_train_and_eval_AMR_LF.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
8,384
45.071429
121
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/compute_confusion_matrix.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
3,725
43.357143
122
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/incremental_train_and_eval_MS.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
5,759
41.666667
107
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/incremental_train_and_eval.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
5,014
41.5
107
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/compute_accuracy.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
3,097
40.306667
116
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/__init__.py
#!/usr/bin/env python # coding=utf-8 # for incremental train and eval
70
16.75
32
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/compute_features.py
#!/usr/bin/env python # coding=utf-8 #!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import...
1,503
33.181818
99
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/incremental_train_and_eval_LF.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
5,489
39.970149
107
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/utils_incremental/incremental_train_and_eval_MR_LF.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
8,171
44.149171
107
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/gen_imagenet_subset.py
#!/usr/bin/env python # coding=utf-8 import argparse import os import random import shutil import time import warnings import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data import t...
1,499
26.777778
79
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/resnet.py
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pytorch.org/models/r...
6,582
29.906103
90
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/utils_pytorch.py
#!/usr/bin/env python # coding=utf-8 from __future__ import print_function, division import torch import torch.nn as nn import torch.nn.init as init from collections import OrderedDict import numpy as np import os import os.path as osp import sys import time import math import subprocess try: import cPickle as pi...
4,102
26.172185
96
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/eval_cumul_acc.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
6,830
45.469388
128
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/class_incremental_imagenet.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
22,015
52.307506
132
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/modified_resnet.py
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import modified_linear def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBloc...
3,850
32.198276
88
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/cbf_class_incremental_cosine_imagenet.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
47,336
60.08
136
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/class_incremental_cosine_imagenet.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
30,418
53.809009
132
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/gen_resized_imagenet.py
#!/usr/bin/env python # coding=utf-8 import argparse import os import random import shutil import time import warnings import numpy as np import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data import t...
1,507
28
75
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/modified_linear.py
import math import torch from torch.nn.parameter import Parameter from torch.nn import functional as F from torch.nn import Module class CosineLinear(Module): def __init__(self, in_features, out_features, sigma=True): super(CosineLinear, self).__init__() self.in_features = in_features self...
2,235
36.898305
78
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/utils_imagenet/train_and_eval.py
import argparse import os import shutil import time import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms as transforms import torchvi...
2,629
30.309524
75
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/utils_imagenet/__init__.py
#!/usr/bin/env python # coding=utf-8 # for incremental-class train and eval
76
18.25
38
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/utils_imagenet/utils_dataset.py
import argparse import os import shutil import time import numpy as np #split trainset.imgs def split_images_labels(imgs): images = [] labels = [] for item in imgs: images.append(item[0]) labels.append(item[1]) return np.array(images), np.array(labels) #merge into trainset.imgs def me...
576
19.607143
45
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/imagenet-class-incremental/utils_imagenet/utils_train.py
import argparse import os import shutil import time import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.distributed as dist import torch.optim import torch.utils.data import torch.utils.data.distributed import torchvision.transforms as transforms import torchvi...
2,897
29.505263
78
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/utils_pytorch.py
#!/usr/bin/env python # coding=utf-8 from __future__ import print_function, division import torch import torch.nn as nn import torch.nn.init as init from collections import OrderedDict import numpy as np import os import os.path as osp import sys import time import math import subprocess try: import cPickle as pi...
4,102
26.172185
96
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/eval_cumul_acc.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
5,687
43.4375
128
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/class_incremental_cifar100.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
18,765
51.565826
130
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/resnet_cifar.py
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expans...
4,525
29.375839
90
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/modified_resnet_cifar.py
#remove ReLU in the last layer, and use cosine layer to replace nn.Linear import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import modified_linear def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, st...
3,716
31.893805
87
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/class_incremental_cosine_cifar100.py
#!/usr/bin/env python # coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision import datasets, models, transforms from torch.autograd import Variable import numpy as np import time import os im...
26,967
53.370968
131
py
CVPR19_Incremental_Learning
CVPR19_Incremental_Learning-master/cifar100-class-incremental/modified_linear.py
import math import torch from torch.nn.parameter import Parameter from torch.nn import functional as F from torch.nn import Module class CosineLinear(Module): def __init__(self, in_features, out_features, sigma=True): super(CosineLinear, self).__init__() self.in_features = in_features self...
2,235
36.898305
78
py
BarchartReverseEngineering
BarchartReverseEngineering-master/generate_random_bar_chart.py
#!/usr/bin/env python # coding: utf-8 # In[1]: import os import matplotlib matplotlib.use("Agg") import random import string import itertools import argparse import numpy as np import matplotlib.pyplot as plt from matplotlib import font_manager from matplotlib import cm from tqdm import tqdm # In[2]: ### random ...
14,987
35.556098
117
py
TRSSL
TRSSL-main/train.py
import argparse import os import shutil import time import random import math import numpy as np from datetime import datetime from tqdm import tqdm import torch import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data as data import torch.nn.functional as F from utils.utils import Bar...
19,121
40.934211
183
py
TRSSL
TRSSL-main/models/build_model.py
import torch def build_model(args, ema=False): if args.dataset in ['cifar10', 'cifar100']: from . import resnet_cifar as models elif args.dataset == 'tinyimagenet': from . import resnet_tinyimagenet as models else: from . import resnet as models if args.arch == 'resnet18': ...
692
24.666667
55
py
TRSSL
TRSSL-main/models/resnet.py
import torch from torch import Tensor import torch.nn as nn # from .._internally_replaced_utils import load_state_dict_from_url from typing import Type, Any, Callable, Union, List, Optional import torch.nn.functional as F __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'r...
15,539
38.846154
111
py
TRSSL
TRSSL-main/models/resnet_tinyimagenet.py
""" This code is based on the Torchvision repository, which was licensed under the BSD 3-Clause. """ import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1, is_last=False): super(BasicBlock, self).__...
5,141
37.088889
104
py
TRSSL
TRSSL-main/models/resnet_cifar.py
""" This code is based on the Torchvision repository, which was licensed under the BSD 3-Clause. """ import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1, is_last=False): super(BasicBlock, self).__...
5,073
36.865672
104
py
TRSSL
TRSSL-main/datasets/datasets.py
import numpy as np from PIL import Image, ImageFilter, ImageOps import random from torchvision import datasets, transforms import torch import pickle import os import math # normalization parameters cifar10_mean, cifar10_std = (0.4914, 0.4822, 0.4465), (0.2471, 0.2435, 0.2616) cifar100_mean, cifar100_std = (0.5071, 0...
29,457
41.203438
214
py
TRSSL
TRSSL-main/utils/utils.py
import os import torch import numpy as np import random from progress.bar import Bar as Bar import torch.nn.functional as F import shutil import matplotlib.pyplot as plt def accuracy(output, target, topk=(1,)): """Computes the precision@k for the specified values of k""" maxk = max(topk) batch_size = targ...
4,886
30.127389
95
py
TRSSL
TRSSL-main/utils/evaluate_utils.py
import numpy as np import torch import torch.nn.functional as F from sklearn import metrics from scipy.optimize import linear_sum_assignment @torch.no_grad() def hungarian_evaluate(predictions, targets, offset=0): # Hungarian matching targets = targets - offset predictions = predictions - offset predi...
2,269
36.213115
161
py
TRSSL
TRSSL-main/utils/uncr_util.py
import random import time import pickle import numpy as np import torch import torch.nn.functional as F from tqdm import tqdm from .utils import AverageMeter def uncr_generator(args, data_loader, model): batch_time = AverageMeter() data_time = AverageMeter() end = time.time() pseudo_idx = [] pseud...
3,161
31.265306
158
py
TRSSL
TRSSL-main/utils/sinkhorn_knopp.py
import torch import numpy as np def shoot_infs(inp_tensor): """Replaces inf by maximum of tensor""" mask_inf = torch.isinf(inp_tensor) ind_inf = torch.nonzero(mask_inf) if len(ind_inf) > 0: for ind in ind_inf: if len(ind) == 2: inp_tensor[ind[0], ind[1]] = 0 ...
2,410
32.957746
105
py
dropmax
dropmax-master/run.py
from __future__ import print_function import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data from lenet import base_softmax, dropmax from accumulator import Accumulator from mnist import mnist_input import time import os import argparse parser = argparse.ArgumentParser() ...
4,155
33.92437
90
py
dropmax
dropmax-master/layers.py
import tensorflow as tf import numpy as np exp = tf.exp log = lambda x: tf.log(x + 1e-20) logit = lambda x: log(x) - log(1-x) sigmoid = tf.nn.sigmoid softmax = tf.nn.softmax relu = tf.nn.relu tau = 0.1 eps = 1e-20 dense = tf.layers.dense flatten = tf.contrib.layers.flatten # network components def conv(x, filters, k...
1,936
28.348485
78
py
dropmax
dropmax-master/accumulator.py
from __future__ import print_function class Accumulator(): def __init__(self, *args): self.args = args self.argdict = {} for i, arg in enumerate(args): self.argdict[arg] = i self.sums = [0]*len(args) self.cnt = 0 def accum(self, val): val = [val] if ...
1,876
29.770492
68
py
dropmax
dropmax-master/lenet.py
from layers import * def base_softmax(x, y, training, name='base_softmax', reuse=None): x = tf.reshape(x, [-1, 1, 28, 28]) x = conv(x, 20, 5, name=name+'/conv1', reuse=reuse) x = relu(x) x = pool(x, name=name+'/pool1') x = conv(x, 50, 5, name=name+'/conv2', reuse=reuse) x = relu(x) x = pool...
1,968
31.816667
71
py
dropmax
dropmax-master/mnist.py
import numpy as np from tensorflow.examples.tutorials.mnist import input_data def mnist_input(path, nlist): mnist = input_data.read_data_sets(path, one_hot=True, validation_size=0) x, y = mnist.train.images, mnist.train.labels y_ = np.argmax(y, axis=1) xtr = [x[y_==k][:nlist[k],:] for k in range(10)] ...
737
37.842105
76
py
BiRTE
BiRTE-main/main.py
from transformers import WEIGHTS_NAME,AdamW, get_linear_schedule_with_warmup from bert4keras.tokenizers import Tokenizer from model import BiRTE from util import * from tqdm import tqdm import random import os import torch.nn as nn import torch from transformers.modeling_bert import BertConfig import json def search(p...
18,791
39.32618
126
py
BiRTE
BiRTE-main/model.py
from transformers.modeling_bert import BertModel,BertPreTrainedModel import torch.nn as nn import torch from torch.autograd import Variable import numpy as np class Biaffine(nn.Module): ''' Args: in1_features: size of each first input sample in2_features: size of each second input sample ...
7,229
36.46114
100
py
BiRTE
BiRTE-main/run.py
import argparse from main import * import torch parser = argparse.ArgumentParser(description='Model Controller') parser.add_argument('--cuda_id', default="0", type=str) parser.add_argument('--base_path', default="./dataset", type=str) parser.add_argument('--dataset', default='WebNLG', type=str) parser.add_argument('--...
1,383
45.133333
108
py
BiRTE
BiRTE-main/util.py
#! -*- coding:utf-8 -*- import numpy as np import random from copy import deepcopy import os import pickle import torch import json def get_more_data(all_data): s_more = [] o_more = [] for ex in all_data: all_s = set() all_o = set() for s, p, o in ex["triple_list"]: all...
12,507
32.354667
114
py
BiRTE
BiRTE-main/bert4keras/optimizers.py
# -*- coding: utf-8 -*- # 优化相关 import numpy as np import tensorflow as tf from bert4keras.backend import keras, K, is_tf_keras from bert4keras.snippets import is_string, string_matching from bert4keras.snippets import is_one_of, insert_arguments from bert4keras.backend import piecewise_linear import re class Adam(ke...
34,935
34.360324
83
py
BiRTE
BiRTE-main/bert4keras/tokenizers.py
#! -*- coding: utf-8 -*- # 工具函数 import unicodedata, re from bert4keras.snippets import is_string, is_py2 from bert4keras.snippets import open def load_vocab(dict_path, encoding='utf-8', simplified=False, startswith=None): """从bert的词典文件中读取词典 """ token_dict = {} with open(dict_path, encoding=encoding) ...
15,186
31.450855
502
py
BiRTE
BiRTE-main/bert4keras/layers.py
#! -*- coding: utf-8 -*- # 自定义层 import numpy as np import tensorflow as tf from bert4keras.backend import keras, K from bert4keras.backend import search_layer from bert4keras.backend import sequence_masking from bert4keras.backend import pool1d from bert4keras.backend import divisible_temporal_padding from bert4keras....
31,362
33.464835
80
py
BiRTE
BiRTE-main/bert4keras/snippets.py
#! -*- coding: utf-8 -*- # 代码合集 import six import logging import numpy as np import re import sys _open_ = open is_py2 = six.PY2 if not is_py2: basestring = str def is_string(s): """判断是否是字符串 """ return isinstance(s, basestring) def strQ2B(ustring): """全角符号转对应的半角符号 """ rstring = '' ...
15,499
28.807692
80
py
BiRTE
BiRTE-main/bert4keras/backend.py
# -*- coding: utf-8 -*- # 分离后端函数,主要是为了同时兼容原生keras和tf.keras # 通过设置环境变量TF_KERAS=1来切换tf.keras import os, sys from distutils.util import strtobool import numpy as np import tensorflow as tf # 判断是tf.keras还是纯keras的标记 is_tf_keras = strtobool(os.environ.get('TF_KERAS', '0')) if is_tf_keras: import tensorflow.keras as ke...
5,182
23.799043
73
py
BiRTE
BiRTE-main/bert4keras/models.py
#! -*- coding: utf-8 -*- # 主要模型 import numpy as np from bert4keras.layers import * from bert4keras.snippets import delete_arguments from keras.models import Model import json class Transformer(object): """模型基类 """ def __init__( self, vocab_size, # 词表大小 hidden_size, # 编码维度 ...
62,335
32.157447
87
py
BiRTE
BiRTE-main/bert4keras/__init__.py
#! -*- coding: utf-8 -*- __version__ = '0.7.2'
48
11.25
24
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/visualization.py
''' Author: Zhengxiang (Jack) Wang GitHub: https://github.com/jaaack-wang Website: https://jaaack-wang.eu.org About: visualization function. ''' import matplotlib.pyplot as plt def plot_training_log(log, show_plot=True, saved_plot_fp=None): log = log.copy() if "Best eval accu" in log: log.pop("Best e...
3,737
31.789474
77
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/dataloader.py
''' Author: Zhengxiang (Jack) Wang GitHub: https://github.com/jaaack-wang Website: https://jaaack-wang.eu.org About: Code for creating dataloader in PyTorch ''' import torch from functools import partial from torch.utils.data import Dataset, DataLoader import sys import pathlib # import from local script sys.path.ins...
6,202
32.711957
75
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/utils.py
''' - Author: Zhengxiang (Jack) Wang - GitHub: https://github.com/jaaack-wang - Website: https://jaaack-wang.eu.org - About: General utility functions for handling files. ''' import os from os import listdir, walk from os.path import isfile, join, exists import random import json def read_data(filepath, skip=0, sep...
2,324
25.724138
90
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/model.py
''' Author: Zhengxiang (Jack) Wang GitHub: https://github.com/jaaack-wang Website: https://jaaack-wang.eu.org About: RNN Seq2Seq models (Simple RNN, GRU, LSTM) in PyTorch. Allows: attention, bidirectional RNN, as well as multilayered RNN etc. ''' import random import torch import torch.nn as nn import torch.nn.functio...
7,864
38.522613
80
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/data.py
''' - Author: Zhengxiang (Jack) Wang - GitHub: https://github.com/jaaack-wang - Website: https://jaaack-wang.eu.org - About: Code for generating train, dev, test, and gen sets containing string pairs applying the following string transducation functions: identity (w --> w), reveral (w --> w^R), total reduplication ...
4,819
32.013699
86
py
rnn-seq2seq-learning
rnn-seq2seq-learning-main/scripts/pytorch_utils.py
''' Author: Zhengxiang (Jack) Wang GitHub: https://github.com/jaaack-wang Website: https://jaaack-wang.eu.org About: Utility functions for training, evaluation, and deployment (i.e., prediction). ''' import torch import torch.nn as nn import torch.nn.init as init from functools import partial import matplotlib.pyplot ...
13,983
35.511749
89
py
libai
libai-main/setup.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
3,998
26.770833
96
py
libai
libai-main/libai/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,062
30.264706
74
py
libai
libai-main/libai/scheduler/lr_scheduler.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
10,480
39.624031
99
py
libai
libai-main/libai/scheduler/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
828
32.16
74
py
libai
libai-main/libai/scheduler/build.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
845
34.25
74
py
libai
libai-main/libai/evaluation/reg_evaluator.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
2,094
29.362319
74
py
libai
libai-main/libai/evaluation/utils.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
3,505
36.297872
98
py
libai
libai-main/libai/evaluation/evaluator.py
# coding=utf-8 # Copyright 2021 The OneFlow Authors. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. # # 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...
11,242
36.983108
99
py
libai
libai-main/libai/evaluation/bleu_evaluator.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,888
28.061538
82
py
libai
libai-main/libai/evaluation/ppl_evaluator.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,794
28.42623
74
py
libai
libai-main/libai/evaluation/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
903
40.090909
74
py
libai
libai-main/libai/evaluation/cls_evaluator.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
2,773
31.635294
88
py
libai
libai-main/libai/config/arguments.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
2,877
34.530864
96
py
libai
libai-main/libai/config/config.py
# coding=utf-8 # Copyright 2021 The OneFlow Authors. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. # # 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...
6,972
34.040201
100
py
libai
libai-main/libai/config/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
958
30.966667
74
py
libai
libai-main/libai/config/lazy.py
# coding=utf-8 # Copyright 2021 The OneFlow Authors. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. # # 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...
17,312
36.3125
96
py
libai
libai-main/libai/config/instantiate.py
# coding=utf-8 # Copyright 2021 The OneFlow Authors. All rights reserved. # Copyright (c) Facebook, Inc. and its affiliates. # # 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...
6,348
30.430693
99
py
libai
libai-main/libai/models/gpt_model.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
16,017
39.045
100
py
libai
libai-main/libai/models/t5_model.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
22,776
42.88632
100
py
libai
libai-main/libai/models/swin_transformer.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
29,510
37.177232
100
py
libai
libai-main/libai/models/bert_model.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
24,272
40.001689
100
py
libai
libai-main/libai/models/vision_transformer.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
10,057
36.529851
85
py
libai
libai-main/libai/models/resmlp.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
10,622
34.888514
94
py
libai
libai-main/libai/models/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,466
31.6
82
py
libai
libai-main/libai/models/roberta_model.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
21,479
40.871345
99
py
libai
libai-main/libai/models/swin_transformer_v2.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
34,295
37.064373
100
py
libai
libai-main/libai/models/build.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
2,277
41.185185
93
py
libai
libai-main/libai/models/utils/weight_init.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,119
28.473684
74
py
libai
libai-main/libai/models/utils/graph_base.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
6,034
38.966887
123
py
libai
libai-main/libai/models/utils/__init__.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
1,271
49.88
84
py
libai
libai-main/libai/models/utils/model_loader/gpt_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
7,937
44.36
100
py
libai
libai-main/libai/models/utils/model_loader/bert_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
12,335
45.727273
100
py
libai
libai-main/libai/models/utils/model_loader/swin_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
12,908
42.173913
99
py
libai
libai-main/libai/models/utils/model_loader/vit_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
9,666
41.774336
96
py
libai
libai-main/libai/models/utils/model_loader/base_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
22,702
36.964883
100
py
libai
libai-main/libai/models/utils/model_loader/swinv2_loader.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
14,228
43.886435
100
py