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
nuts-ml
nuts-ml-master/nutsml/examples/keras_/autoencoder/conv_autoencoder.py
""" A simple convolutional autoencoder adapted from https://blog.keras.io/building-autoencoders-in-keras.html """ from nutsml import KerasNetwork from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D from tensorflow.keras.models import Model from runner import INPUT_SHAPE def create_network()...
1,312
36.514286
77
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/autoencoder/runner.py
""" Runs training and prediction. Trains an autoencoder on MNIST and in the prediction phase shows the original image, the decoded images and the difference. """ from __future__ import print_function import numpy as np from six.moves import zip, range from nutsflow import * from nutsml import * NUM_EPOCHS = 10 #...
2,640
26.8
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/cnn_train.py
""" .. module:: cnn_train :synopsis: Example nuts-ml pipeline for training a CNN on MNIST This is code is based on a Keras example (see here) https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py to train a Multi-layer perceptron on the MNIST data and modified to use nuts for the data-preprocessing. "...
3,378
34.568421
78
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/write_images.py
""" .. module:: write_images :synopsis: Example for writing of image data """ from six.moves import zip from nutsflow import Take, Consume, Enumerate, Zip, Format, Get, Print from nutsml import WriteImage def load_samples(): from keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.loa...
681
28.652174
80
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/mnist/mlp_train.py
""" .. module:: mlp_train :synopsis: Example nuts-ml pipeline for training and evaluation This is code is based on a Keras example (see here) https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py to train a Multi-layer perceptron on the MNIST data and modified to use nuts for the data-preprocessing. "...
2,820
31.056818
73
py
nuts-ml
nuts-ml-master/nutsml/examples/keras_/cifar/cnn_train.py
""" .. module:: mlp_view_misclassified :synopsis: Example for showing misclassified examples """ from __future__ import print_function import pickle import os.path as osp from six.moves import zip, map, range from nutsflow import PrintProgress, Zip, Unzip, Pick, Shuffle, Mean from nutsml import (KerasNetwork, Tr...
4,395
33.614173
76
py
Excessive-Invariance
Excessive-Invariance-master/l0/invariant_l0_attack.py
import tensorflow as tf import random import time import numpy as np from keras.datasets import mnist import sys import os import itertools import sklearn.cluster import scipy.misc import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Activation from keras.layers import Con...
14,333
36.03876
152
py
irbl
irbl-master/src/main.py
import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import LabelEncoder from sklearn import datasets from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import os from sklearn.calib...
67,075
35.673592
199
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/embedding.py
from sentence_transformers import SentenceTransformer, util from numpy import add from torch import Tensor from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler def get_model(name): """ Loads the SentenceTransformer for the specific model. If the model is not stored it will be dow...
5,370
42.314516
125
py
mooc_knowledge_gain
mooc_knowledge_gain-main/feature_extraction/files.py
import os import sys import csv import fitz import processor import client import embedding import re import scipy import numpy import torch from operator import itemgetter from SortedCollection import SortedCollection def load_stop_words(path): """ Loads stopwords of the stopwords.txt file to use them later ...
34,651
50.642325
119
py
GoogleScraper
GoogleScraper-master/GoogleScraper/parsing-new-version.py
# -*- coding: utf-8 -*- import sys import os import re import lxml.html from lxml.html.clean import Cleaner from urllib.parse import unquote import pprint import logging from cssselect import HTMLTranslator logger = logging.getLogger(__name__) class InvalidSearchTypeException(Exception): pass class UnknowUrlE...
38,678
34.355576
151
py
GoogleScraper
GoogleScraper-master/GoogleScraper/parsing.py
# -*- coding: utf-8 -*- import sys import os import re import lxml.html from lxml.html.clean import Cleaner from urllib.parse import unquote import pprint from GoogleScraper.database import SearchEngineResultsPage import logging from cssselect import HTMLTranslator logger = logging.getLogger(__name__) class Invalid...
39,004
34.203069
153
py
GoogleScraper
GoogleScraper-master/GoogleScraper/selenium_mode.py
# -*- coding: utf-8 -*- import tempfile import threading from urllib.parse import quote import json import datetime import time import math import random import re import sys import os try: from selenium import webdriver from selenium.common.exceptions import TimeoutException, WebDriverException from sele...
36,591
37.845011
147
py
GoogleScraper
GoogleScraper-master/docs/source/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
5,975
29.181818
79
py
crnn-pytorch
crnn-pytorch-master/utils.py
#!/usr/bin/python # encoding: utf-8 import torch import torch.nn as nn from torch.autograd import Variable import collections class strLabelConverter(object): """Convert between str and label. NOTE: Insert `blank` to the alphabet for CTC. Args: alphabet (str): set of the possible charac...
4,860
28.107784
136
py
crnn-pytorch
crnn-pytorch-master/dataset.py
#!/usr/bin/python # encoding: utf-8 import random import torch from torch.utils.data import Dataset from torch.utils.data import sampler import torchvision.transforms as transforms import lmdb import six import sys from PIL import Image import numpy as np class lmdbDataset(Dataset): def __init__(self, root=None...
4,008
28.262774
78
py
crnn-pytorch
crnn-pytorch-master/demo.py
import torch from torch.autograd import Variable import utils import dataset from PIL import Image import models.crnn as crnn import params import argparse parser = argparse.ArgumentParser() parser.add_argument('-m', '--model_path', type = str, required = True, help = 'crnn model path') parser.add_argument('-i', '--i...
1,455
27.54902
96
py
crnn-pytorch
crnn-pytorch-master/train.py
from __future__ import print_function from __future__ import division import argparse import random import torch import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from torch.autograd import Variable import numpy as np # from warpctc_pytorch import CTCLoss from torch.nn import CTC...
8,227
29.587361
133
py
crnn-pytorch
crnn-pytorch-master/models/crnn.py
import torch.nn as nn import params import torch.nn.functional as F class BidirectionalLSTM(nn.Module): def __init__(self, nIn, nHidden, nOut): super(BidirectionalLSTM, self).__init__() self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True) self.embedding = nn.Linear(nHidden * 2, nOut) ...
2,865
30.494505
78
py
crnn-pytorch
crnn-pytorch-master/tool/convert_t7.py
import torchfile import argparse import torch from torch.nn.parameter import Parameter import numpy as np import models.crnn as crnn layer_map = { 'SpatialConvolution': 'Conv2d', 'SpatialBatchNormalization': 'BatchNorm2d', 'ReLU': 'ReLU', 'SpatialMaxPooling': 'MaxPool2d', 'SpatialAveragePooling': ...
5,075
29.214286
76
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/parser.py
import os import torch import argparse def parse_arguments(): parser = argparse.ArgumentParser(description="Benchmarking Visual Geolocalization", formatter_class=argparse.ArgumentDefaultsHelpFormatter) # Training parameters parser.add_argument("--train_batch_size", ty...
9,823
70.188406
142
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/test.py
import faiss import torch import logging import numpy as np from tqdm import tqdm from torch.utils.data import DataLoader from torch.utils.data.dataset import Subset def test_efficient_ram_usage(args, eval_ds, model, test_method="hard_resize"): """This function gives the same output as test(), but uses much less...
14,018
53.761719
121
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/commons.py
""" This file contains some functions and classes which can be useful in very diverse projects. """ import os import sys import torch import random import logging import traceback import numpy as np from os.path import join def make_deterministic(seed=0): """Make results deterministic. If seed == -1, do not mak...
2,811
36.493333
91
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/util.py
import re import torch import shutil import logging import torchscan import numpy as np from collections import OrderedDict from os.path import join from sklearn.decomposition import PCA import datasets_ws def get_flops(model, input_shape=(480, 640)): """Return the FLOPs as a string, such as '22.33 GFLOPs'""" ...
3,201
40.584416
102
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/datasets_ws.py
import os import torch import faiss import logging import numpy as np from glob import glob from tqdm import tqdm from PIL import Image from os.path import join import torch.utils.data as data import torchvision.transforms as T from torch.utils.data.dataset import Subset from sklearn.neighbors import NearestNeighbors ...
23,388
56.750617
138
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/eval.py
""" With this script you can evaluate checkpoints or test models from two popular landmark retrieval github repos. The first is https://github.com/naver/deep-image-retrieval from Naver labs, provides ResNet-50 and ResNet-101 trained with AP on Google Landmarks 18 clean. $ python eval.py --off_the_shelf=naver --l2=none...
5,209
46.363636
146
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/train.py
import math import torch import logging import numpy as np from tqdm import tqdm import torch.nn as nn import multiprocessing from os.path import join from datetime import datetime import torchvision.transforms as transforms from torch.utils.data.dataloader import DataLoader import util import test import parser impo...
10,186
45.729358
133
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/aggregation.py
import math import torch import faiss import logging import numpy as np from tqdm import tqdm import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.utils.data import DataLoader, SubsetRandomSampler import model.functional as LF import model.normalization as normaliz...
10,963
41.007663
132
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/network.py
import os import torch import logging import torchvision from torch import nn from os.path import join from transformers import ViTModel from google_drive_downloader import GoogleDriveDownloader as gdd from model.cct import cct_14_7x2_384 from model.aggregation import Flatten from model.normalization import L2Norm im...
9,160
43.687805
137
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/functional.py
import math import torch import torch.nn.functional as F def sare_ind(query, positive, negative): '''all 3 inputs are supposed to be shape 1xn_features''' dist_pos = ((query - positive)**2).sum(1) dist_neg = ((query - negative)**2).sum(1) dist = - torch.cat((dist_pos, dist_neg)) dist = F.log_...
3,170
36.305882
105
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/normalization.py
import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): def __init__(self, dim=1): super().__init__() self.dim = dim def forward(self, x): return F.normalize(x, p=2, dim=self.dim)
238
18.916667
48
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/sync_batchnorm/replicate.py
# -*- coding: utf-8 -*- # File : replicate.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import functools from torch.nn.parallel.da...
3,226
32.968421
115
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/sync_batchnorm/unittest.py
# -*- coding: utf-8 -*- # File : unittest.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import unittest import torch class TorchTes...
768
24.633333
76
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/sync_batchnorm/batchnorm.py
# -*- coding: utf-8 -*- # File : batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import collections import contextlib import...
16,465
38.869249
135
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/sync_batchnorm/batchnorm_reimpl.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : batchnorm_reimpl.py # Author : acgtyrant # Date : 11/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import torch import torch.nn as nn import torch...
2,385
30.813333
95
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/transformers.py
import torch from torch.nn import Module, ModuleList, Linear, Dropout, LayerNorm, Identity, Parameter, init import torch.nn.functional as F from .stochastic_depth import DropPath class Attention(Module): """ Obtained from timm: github.com:rwightman/pytorch-image-models """ def __init__(self, dim, num...
13,211
38.088757
112
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/embedder.py
import torch.nn as nn class Embedder(nn.Module): def __init__(self, word_embedding_dim=300, vocab_size=100000, padding_idx=1, pretrained_weight=None, embed_freeze=False, *args, **kwargs): super(Embedder, ...
1,332
34.078947
96
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/stochastic_depth.py
# Thanks to rwightman's timm package # github.com:rwightman/pytorch-image-models import torch import torch.nn as nn def drop_path(x, drop_prob: float = 0., training: bool = False): """ Obtained from: github.com:rwightman/pytorch-image-models Drop paths (Stochastic Depth) per sample (when applied in main ...
1,586
38.675
108
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/cct.py
from torch.hub import load_state_dict_from_url import torch.nn as nn import torch import torch.nn.functional as F from .transformers import TransformerClassifier from .tokenizer import Tokenizer from .helpers import pe_check from timm.models.registry import register_model model_urls = { 'cct_7_3x1_32': '...
15,794
42.753463
114
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/tokenizer.py
import torch import torch.nn as nn import torch.nn.functional as F class Tokenizer(nn.Module): def __init__(self, kernel_size, stride, padding, pooling_kernel_size=3, pooling_stride=2, pooling_padding=1, n_conv_layers=1, n_input_channels=3, ...
4,035
35.690909
95
py
deep-visual-geo-localization-benchmark
deep-visual-geo-localization-benchmark-main/model/cct/helpers.py
import math import torch import torch.nn.functional as F def resize_pos_embed(posemb, posemb_new, num_tokens=1): # Copied from `timm` by Ross Wightman: # github.com/rwightman/pytorch-image-models # Rescale the grid of position embeddings when loading from state_dict. Adapted from # https://github.com/...
1,573
46.69697
132
py
anomaly-seg
anomaly-seg-master/dataset.py
import os import json import torch from torchvision import transforms import numpy as np from PIL import Image def imresize(im, size, interp='bilinear'): if interp == 'nearest': resample = Image.NEAREST elif interp == 'bilinear': resample = Image.BILINEAR elif interp == 'bicubic': ...
11,901
39.074074
108
py
anomaly-seg
anomaly-seg-master/eval_ood.py
# System libs import os import time import argparse from distutils.version import LooseVersion # Numerical libs import numpy as np import torch import torch.nn as nn from scipy.io import loadmat # Our libs from config import cfg from dataset import ValDataset from models import ModelBuilder, SegmentationModule from uti...
10,392
34.35034
116
py
fmriprep
fmriprep-master/docs/conf.py
# fmriprep documentation build configuration file, created by # sphinx-quickstart on Mon May 9 09:04:25 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values h...
11,942
32.642254
89
py
PIBConv
PIBConv-main/cnn/complexity.py
import torch from model import * from genotypes import * from ptflops import get_model_complexity_info def print_complexity(network): macs, params = get_model_complexity_info(network, (3, 32, 32), as_strings=True, print_per_layer_stat=True, verbose=True) print('{:<30}...
788
31.875
127
py
PIBConv
PIBConv-main/cnn/train_cpath.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import genotypes import torch.nn as nn import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkADP as...
13,664
43.366883
118
py
PIBConv
PIBConv-main/cnn/apply_gradcam.py
import argparse import cv2 import numpy as np import torch from torchvision import models from pytorch_grad_cam import GradCAM, \ HiResCAM, \ ScoreCAM, \ GradCAMPlusPlus, \ AblationCAM, \ XGradCAM, \ EigenCAM, \ EigenGradCAM, \ LayerCAM, \ FullGrad, \ GradCAMElementWise from mode...
5,853
34.26506
100
py
PIBConv
PIBConv-main/cnn/test_cpath.py
import os import sys import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkADP as Network # for ADP dataset fr...
7,551
42.154286
141
py
PIBConv
PIBConv-main/cnn/train_search_rmsgd.py
from operator import index import os #os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" #os.environ["CUDA_VISIBLE_DEVICES"] = "1,2,3" print("bruv") import sys import time import glob import utils import logging import argparse import numpy as np import pandas as pd import pickle import torch import torch.nn as nn import t...
24,566
42.713523
153
py
PIBConv
PIBConv-main/cnn/architect.py
import torch import numpy as np import torch.nn as nn import torch.backends.cudnn as cudnn from torch.autograd import Variable from collections import OrderedDict def _concat(xs): return torch.cat([x.view(-1) for x in xs]) class Architect(object): def __init__(self, model, criterion, args): gpus = [...
11,819
48.456067
133
py
PIBConv
PIBConv-main/cnn/train_imagenet.py
import os import sys import numpy as np import time import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from torc...
8,636
34.9875
106
py
PIBConv
PIBConv-main/cnn/train_search_adas.py
import os import sys import time import glob import utils import logging import argparse import numpy as np import pandas as pd import torch import torch.nn as nn import torch.utils import torch.nn.functional as F import torchvision.datasets as dset import torch.backends.cudnn as cudnn import pickle import gc from cop...
22,044
43.445565
153
py
PIBConv
PIBConv-main/cnn/utils.py
import os import numpy as np import pandas as pd import torch import shutil import torchvision.transforms as transforms from torch.autograd import Variable from torchvision.datasets.utils import check_integrity,\ extract_archive, verify_str_arg, download_and_extract_archive from torchvision.datasets.folder import d...
25,313
33.161943
111
py
PIBConv
PIBConv-main/cnn/model.py
import torch import torch.nn as nn from operations import * from torch.autograd import Variable from utils import drop_path class Cell(nn.Module): def __init__(self, genotype, C_prev_prev, C_prev, C, reduction, reduction_prev): super(Cell, self).__init__() print(C_prev_prev, C_prev, C) i...
10,318
33.627517
90
py
PIBConv
PIBConv-main/cnn/model_search.py
import torch import torch.nn as nn import torch.nn.functional as F from operations import * from torch.autograd import Variable from genotypes import PRIMITIVES from genotypes import Genotype class MixedOp(nn.Module): def __init__(self, C, stride, learnable_bn): super(MixedOp, self).__init__() self...
7,707
36.057692
144
py
PIBConv
PIBConv-main/cnn/test_cifar.py
import os import sys import glob import numpy as np import pandas as pd import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import Netwo...
4,431
34.456
106
py
PIBConv
PIBConv-main/cnn/test_imagenet.py
import os import sys import numpy as np import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from torch.autograd i...
4,020
33.663793
104
py
PIBConv
PIBConv-main/cnn/train_cifar.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkCIFAR ...
7,720
37.412935
117
py
PIBConv
PIBConv-main/cnn/operations.py
import torch import torch.nn as nn import torch.nn.functional as F import math OPS = { 'none': lambda C, stride, affine: Zero(stride), 'avg_pool_3x3': lambda C, stride, affine: nn.AvgPool2d(3, stride=stride, padding=1, count_include_pad=False), 'max_pool_3x3': lambda C, stride, affine: nn.MaxPool2d(3, stri...
6,930
37.082418
115
py
PIBConv
PIBConv-main/cnn/adas/Adas.py
""" """ from torch.optim.optimizer import Optimizer, required import sys import numpy as np import torch mod_name = vars(sys.modules[__name__])['__name__'] if 'adas.' in mod_name: from .metrics import Metrics else: from .optim.metrics import Metrics class Adas(Optimizer): """ Vectorized SGD from t...
5,240
34.174497
78
py
PIBConv
PIBConv-main/cnn/adas/metrics.py
""" """ from typing import List, Union, Tuple import sys import numpy as np import torch mod_name = vars(sys.modules[__name__])['__name__'] if 'adas.' in mod_name: from .components import LayerMetrics, ConvLayerMetrics from .matrix_factorization import EVBMF else: from optim.components import LayerMetric...
7,146
43.391304
85
py
PIBConv
PIBConv-main/cnn/adas/matrix_factorization.py
from __future__ import division import numpy as np # from scipy.sparse.linalg import svds from scipy.optimize import minimize_scalar import torch def EVBMF(Y, sigma2=None, H=None): """Implementation of the analytical solution to Empirical Variational Bayes Matrix Factorization. This function can be ...
5,693
30.458564
91
py
PIBConv
PIBConv-main/cnn/ADP_utils/thresholded_metrics.py
import os import torch import numpy as np import pandas as pd import matplotlib.pyplot as plt from .classesADP import classesADP from sklearn.metrics import roc_curve from sklearn.metrics import auc class Thresholded_Metrics: def __init__(self, targets, predictions, level, network, epoch): se...
6,205
46.738462
146
py
clx-branch-23.04
clx-branch-23.04/examples/run_dga_training.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
2,926
31.522222
119
py
clx-branch-23.04
clx-branch-23.04/python/clx/tests/test_dga_detector.py
# Copyright (c) 2019, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
4,063
32.586777
97
py
clx-branch-23.04
clx-branch-23.04/python/clx/tests/test_asset_classification.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
4,887
38.104
202
py
clx-branch-23.04
clx-branch-23.04/python/clx/tests/test_binary_sequence_classifier.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
3,113
32.12766
96
py
clx-branch-23.04
clx-branch-23.04/python/clx/tests/test_multiclass_sequence_classifier.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
3,132
32.329787
96
py
clx-branch-23.04
clx-branch-23.04/python/clx/tests/test_cybert.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
5,066
43.447368
88
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/asset_classification.py
import cudf from cuml.model_selection import train_test_split import torch import torch.optim as torch_optim import torch.nn.functional as F import logging from torch.utils.dlpack import from_dlpack from clx.analytics.model.tabular_model import TabularModel log = logging.getLogger(__name__) class AssetClassification...
9,402
34.217228
154
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/binary_sequence_classifier.py
import logging import cudf from cudf.core.subword_tokenizer import SubwordTokenizer import torch import torch.nn as nn from torch.utils.dlpack import to_dlpack from clx.analytics.sequence_classifier import SequenceClassifier from clx.utils.data.dataloader import DataLoader from clx.utils.data.dataset import Dataset fr...
3,848
37.878788
256
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/sequence_classifier.py
import logging import os import cudf from cudf.core.subword_tokenizer import SubwordTokenizer import cupy import torch from clx.utils.data.dataloader import DataLoader from clx.utils.data.dataset import Dataset from torch.utils.dlpack import to_dlpack from tqdm import trange from torch.optim import AdamW from abc imp...
8,757
35.953586
256
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/cybert.py
# Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
9,636
36.644531
99
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/detector.py
import logging import torch import torch.nn as nn from abc import ABC, abstractmethod log = logging.getLogger(__name__) GPU_COUNT = torch.cuda.device_count() class Detector(ABC): def __init__(self, lr=0.001): self.lr = lr self._model = None self._optimizer = None self._criterion ...
2,728
25.495146
92
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/dga_detector.py
import cudf import torch import logging from tqdm import trange from torch.utils.dlpack import from_dlpack from clx.utils.data import utils from clx.analytics.detector import Detector from clx.utils.data.dataloader import DataLoader from clx.analytics.dga_dataset import DGADataset from clx.analytics.model.rnn_classifie...
10,504
38.197761
189
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/multiclass_sequence_classifier.py
import logging import cudf from cudf.core.subword_tokenizer import SubwordTokenizer import cupy import torch import torch.nn as nn from torch.utils.dlpack import to_dlpack from clx.analytics.sequence_classifier import SequenceClassifier from clx.utils.data.dataloader import DataLoader from clx.utils.data.dataset impor...
3,867
38.876289
256
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/model/rnn_classifier.py
# Original code at https://github.com/spro/practical-pytorch import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence DROPOUT = 0.0 class RNNClassifier(nn.Module): def __init__( self, input_size, hidden_size, output_size, n_layers, bidirectional=True ): super(RNN...
2,067
31.3125
82
py
clx-branch-23.04
clx-branch-23.04/python/clx/analytics/model/tabular_model.py
# Original code at https://github.com/spro/practical-pytorch import torch import torch.nn as nn class TabularModel(nn.Module): "Basic model for tabular data" def __init__(self, emb_szs, n_cont, out_sz, layers, drops, emb_drop, use_bn, is_reg, is_multi): super().__init__() se...
1,858
38.553191
116
py
pdarts
pdarts-master/test.py
import os import sys import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from model import NetworkCIFAR as Network parser = argparse.ArgumentParser("c...
3,279
31.475248
100
py
pdarts
pdarts-master/train_imagenet.py
import os import sys import numpy as np import time import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from torc...
10,818
38.922509
127
py
pdarts
pdarts-master/utils.py
import os import numpy as np import torch import shutil import torchvision.transforms as transforms from torch.autograd import Variable class AvgrageMeter(object): def __init__(self): self.reset() def reset(self): self.avg = 0 self.sum = 0 self.cnt = 0 def update(self, val, n=1): self.sum...
3,652
24.907801
105
py
pdarts
pdarts-master/model.py
import torch import torch.nn as nn from operations import * from torch.autograd import Variable from utils import drop_path class Cell(nn.Module): def __init__(self, genotype, C_prev_prev, C_prev, C, reduction, reduction_prev): super(Cell, self).__init__() if reduction_prev: self.prep...
7,284
34.710784
95
py
pdarts
pdarts-master/model_search.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from operations import * from torch.autograd import Variable from genotypes import PRIMITIVES from genotypes import Genotype class MixedOp(nn.Module): def __init__(self, C, stride, switch, p): super(MixedOp, self).__ini...
6,003
34.738095
147
py
pdarts
pdarts-master/train_search.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import torch.utils import torch.nn.functional as F import torchvision.datasets as dset import torch.backends.cudnn as cudnn import copy from model_search import Network from gen...
19,015
39.545842
215
py
pdarts
pdarts-master/test_imagenet.py
import os import sys import numpy as np import torch import utils import glob import random import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torchvision.transforms as transforms import torch.backends.cudnn as cudnn from model import Net...
3,334
31.378641
116
py
pdarts
pdarts-master/train_cifar.py
import os import sys import time import glob import numpy as np import torch import utils import logging import argparse import torch.nn as nn import genotypes import torch.utils import torchvision.datasets as dset import torch.backends.cudnn as cudnn from torch.autograd import Variable from model import NetworkCIFAR ...
7,688
39.68254
113
py
pdarts
pdarts-master/operations.py
import torch import torch.nn as nn OPS = { 'none' : lambda C, stride, affine: Zero(stride), 'avg_pool_3x3' : lambda C, stride, affine: nn.AvgPool2d(3, stride=stride, padding=1, count_include_pad=False), 'max_pool_3x3' : lambda C, stride, affine: nn.MaxPool2d(3, stride=stride, padding=1), 'skip_connect' : lambd...
4,144
32.97541
129
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/run_exp.py
########################################################## # pytorch-kaldi-gan # Walter Heymans # North West University # 2020 # Adapted from: # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## from __futur...
33,246
35.216776
152
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/quaternion_neural_networks.py
########################################################## # Quaternion Neural Networks # Titouan Parcollet, Xinchi Qiu, Mirco Ravanelli # University of Oxford and Mila, University of Montreal # May 2020 ########################################################## import torch import torch.nn.functional as F import torc...
24,754
37.20216
135
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/resample_files.py
import torch import torchaudio import numpy as np import matplotlib.pyplot as plt import configparser import os import sys import random import shutil # Reading global cfg file (first argument-mandatory file) cfg_file = sys.argv[1] if not (os.path.exists(cfg_file)): sys.stderr.write("ERROR: The config file %s does...
1,528
26.303571
107
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/core.py
########################################################## # pytorch-kaldi-gan # Walter Heymans # North West University # 2020 # Adapted from: # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import sys ...
22,371
33.793157
138
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/neural_networks.py
########################################################## # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import torch import torch.nn.functional as F import torch.nn as nn import numpy as np from dist...
73,602
34.049048
226
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/multistyle_training.py
from augmentation_utils import * import configparser import sox import logging logging.getLogger('sox').setLevel(logging.ERROR) # Reading global cfg file (first argument-mandatory file) cfg_file = sys.argv[1] if not (os.path.exists(cfg_file)): sys.stderr.write("ERROR: The config file %s does not exist!\n" % (cfg_...
4,581
34.796875
111
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/utils.py
########################################################## # pytorch-kaldi-gan # Walter Heymans # North West University # 2020 # Adapted from: # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import conf...
110,615
36.598912
206
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/train_gan.py
########################################################## # pytorch-kaldi-gan # Walter Heymans # North West University # 2020 ########################################################## import sys import configparser import os import time import numpy import numpy as np import random import torch import torch.nn.func...
44,242
36.621599
191
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/gan_networks.py
import torch import torch.nn as nn from distutils.util import strtobool from torch.nn.utils import spectral_norm import math class LayerNorm(nn.Module): def __init__(self, features, eps=1e-6): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(features)) self.beta = nn....
20,229
32.001631
111
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/tune_hyperparameters.py
#!/usr/bin/env python ########################################################## # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 # # Description: # This scripts generates config files with the random hyperparamters specified by the user. # python tune_hyperparame...
3,100
35.916667
229
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/weights_and_biases.py
########################################################## # pytorch-kaldi-gan v.1.0 # Walter Heymans # North West University # 2020 ########################################################## import wandb import yaml import os from sys import exit def initialize_wandb(project, config, directory, resume, identity = ""...
1,414
22.983051
83
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/audio_processing.py
import torch import torchaudio import numpy as np import matplotlib.pyplot as plt import configparser import os import sys import random import shutil import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.spectral_norm as spectral_norm # Reading global cfg file (first argument-mandatory file) cf...
18,066
35.061876
144
py
pytorch-kaldi-gan
pytorch-kaldi-gan-master/data_io.py
########################################################## # pytorch-kaldi-gan # Walter Heymans # North West University # 2020 # Adapted from: # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import nump...
55,933
36.767725
142
py