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
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/models_1200.py
import torch.nn as nn import torchvision.datasets as dataset import torch def weights_init(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.normal_(m.weight.data, 0.0, 0.02) elif classname.find('BatchNorm') != -1: nn.init.normal_(m.weight.data, 1.0, 0.02) ...
4,378
31.924812
118
py
Log-Spectral-matching-GAN
Log-Spectral-matching-GAN-main/train_nsr.py
import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt # from models import Discriminator, Generator, weights_init from models_1200 import Discriminator,Generator,weights_init from PPGDataset_40hz import PPGDataloader from scipy.signal import butter, lfilter,welch import torch from torch.auto...
6,853
36.048649
127
py
stylegan-xl
stylegan-xl-main/legacy.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
16,875
50.139394
154
py
stylegan-xl
stylegan-xl-main/gen_video.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
8,063
39.727273
239
py
stylegan-xl
stylegan-xl-main/gen_class_samplesheet.py
import os from pathlib import Path import PIL.Image from typing import List import click import numpy as np import torch from tqdm import tqdm import legacy import dnnlib from training.training_loop import save_image_grid from torch_utils import gen_utils from gen_images import parse_range @click.command() @click.opt...
2,797
38.408451
118
py
stylegan-xl
stylegan-xl-main/run_inversion.py
"""Project given image to the latent space of pretrained network pickle.""" import copy import os from time import perf_counter import dill import click import imageio import numpy as np import PIL.Image import torch import torch.nn.functional as F from tqdm import trange import dnnlib import legacy from metrics imp...
12,935
37.385757
124
py
stylegan-xl
stylegan-xl-main/run_stylemc.py
""" Approach: "StyleMC: Multi-Channel Based Fast Text-Guided Image Generation and Manipulation" Reimplemented and modified by Axel Sauer for "StyleGAN-XL: Scaling StyleGAN to Large Diverse Datasets" """ import os import re import click import legacy from typing import List, Optional import PIL.Image import imageio from...
11,667
31.960452
180
py
stylegan-xl
stylegan-xl-main/gen_images.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
4,981
38.228346
144
py
stylegan-xl
stylegan-xl-main/train.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
17,044
49.280236
185
py
stylegan-xl
stylegan-xl-main/calc_metrics.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
8,527
42.958763
154
py
stylegan-xl
stylegan-xl-main/training/networks_stylegan3_resetting.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
36,167
48.208163
141
py
stylegan-xl
stylegan-xl-main/training/loss.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
8,268
47.928994
145
py
stylegan-xl
stylegan-xl-main/training/augment.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
26,617
59.910755
366
py
stylegan-xl
stylegan-xl-main/training/dataset.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
9,273
35.656126
158
py
stylegan-xl
stylegan-xl-main/training/networks_fastgan.py
# original implementation: https://github.com/odegeasslbc/FastGAN-pytorch/blob/main/models.py # # modified by Axel Sauer for "Projected GANs Converge Faster" # import torch.nn as nn from pg_modules.blocks import (InitLayer, UpBlockBig, UpBlockBigCond, UpBlockSmall, UpBlockSmallCond, SEBlock, conv2d) def normalize_sec...
6,139
32.736264
124
py
stylegan-xl
stylegan-xl-main/training/diffaug.py
# Differentiable Augmentation for Data-Efficient GAN Training # Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han # https://arxiv.org/pdf/2006.10738 import torch import torch.nn.functional as F def DiffAugment(x, policy='', channels_first=True): if policy: if not channels_first: x ...
3,025
38.298701
110
py
stylegan-xl
stylegan-xl-main/training/training_loop.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
27,323
49.6
171
py
stylegan-xl
stylegan-xl-main/training/networks_stylegan2.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
43,357
49.830012
189
py
stylegan-xl
stylegan-xl-main/training/networks_stylegan3.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
32,277
50.398089
141
py
stylegan-xl
stylegan-xl-main/torch_utils/custom_ops.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
6,666
41.196203
146
py
stylegan-xl
stylegan-xl-main/torch_utils/gen_utils.py
# Code from: https://github.com/PDillis/stylegan3-fun import os import re import json from typing import List, Tuple, Union, Optional from collections import OrderedDict from locale import atof import click import numpy as np import torch import torch.nn.functional as F import dnnlib # ----------------------------...
25,284
48.481409
161
py
stylegan-xl
stylegan-xl-main/torch_utils/training_stats.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
10,720
38.855019
118
py
stylegan-xl
stylegan-xl-main/torch_utils/persistence.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
9,752
37.702381
144
py
stylegan-xl
stylegan-xl-main/torch_utils/misc.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
11,872
39.522184
133
py
stylegan-xl
stylegan-xl-main/torch_utils/utils_spectrum.py
import torch from torch.fft import fftn def roll_quadrants(data, backwards=False): """ Shift low frequencies to the center of fourier transform, i.e. [-N/2, ..., +N/2] -> [0, ..., N-1] Args: data: fourier transform, (NxHxW) backwards: bool, if True shift high frequencies back to center ...
5,658
35.275641
127
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/bias_act.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
9,813
45.733333
185
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/grid_sample_gradfix.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
3,020
37.730769
132
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/conv2d_gradfix.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
9,465
46.567839
197
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/upfirdn2d.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
16,392
41.033333
120
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/filtered_lrelu.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
12,915
45.797101
164
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/conv2d_resample.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
6,765
45.986111
130
py
stylegan-xl
stylegan-xl-main/torch_utils/ops/fma.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
2,047
32.57377
105
py
stylegan-xl
stylegan-xl-main/viz/renderer.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
15,336
39.467018
164
py
stylegan-xl
stylegan-xl-main/metrics/metric_utils.py
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
14,459
39.847458
198
py
stylegan-xl
stylegan-xl-main/metrics/equivariance.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
10,868
39.55597
165
py
stylegan-xl
stylegan-xl-main/metrics/perceptual_path_length.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
5,256
40.722222
131
py
stylegan-xl
stylegan-xl-main/metrics/metric_main.py
# distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. """Main API for computing and reporting quality metrics.""" import os import time import json import torch import dnnlib from . import metric_utils from . import frechet_in...
6,733
35.797814
147
py
stylegan-xl
stylegan-xl-main/metrics/precision_recall.py
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
3,738
56.523077
159
py
stylegan-xl
stylegan-xl-main/feature_networks/vit.py
import torch import torch.nn as nn import timm import types import math import torch.nn.functional as F class Slice(nn.Module): def __init__(self, start_index=1): super(Slice, self).__init__() self.start_index = start_index def forward(self, x): return x[:, self.start_index :] class...
14,450
28.371951
101
py
stylegan-xl
stylegan-xl-main/feature_networks/pretrained_builder.py
import numpy as np import torch import torch.nn as nn import torchvision.models as zoomodels from torch.autograd import Function import timm from feature_networks import clip from feature_networks.vit import _make_vit_b16_backbone, forward_vit from feature_networks.constants import ALL_MODELS, VITS, EFFNETS, REGNETS ...
13,405
31.07177
93
py
stylegan-xl
stylegan-xl-main/feature_networks/clip/clip.py
import hashlib import os import urllib import warnings from typing import Union, List import torch import torch.nn as nn from PIL import Image from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize from tqdm import tqdm from .model import build_model from .simple_tokenizer import SimpleTo...
9,329
37.081633
142
py
stylegan-xl
stylegan-xl-main/feature_networks/clip/model.py
from collections import OrderedDict from typing import Tuple, Union import numpy as np import torch import torch.nn.functional as F from torch import nn class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1): super().__init__() # all conv layers have strid...
18,151
38.982379
178
py
stylegan-xl
stylegan-xl-main/pg_modules/projector.py
import torch import torch.nn as nn from feature_networks.vit import forward_vit from feature_networks.pretrained_builder import _make_pretrained from feature_networks.constants import NORMALIZED_INCEPTION, NORMALIZED_IMAGENET, NORMALIZED_CLIP, VITS from pg_modules.blocks import FeatureFusionBlock def get_backbone_nor...
5,678
34.716981
114
py
stylegan-xl
stylegan-xl-main/pg_modules/discriminator.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import Normalize import pickle from training.diffaug import DiffAugment from training.networks_stylegan2 import FullyConnectedLayer from pg_modules.blocks import conv2d, DownBlock, DownBlockPatch from pg_m...
7,513
33.46789
137
py
stylegan-xl
stylegan-xl-main/pg_modules/blocks.py
import functools import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import spectral_norm from training.networks_stylegan2 import Conv2dLayer, Conv2dLayerDepthwise ### single layers def conv2d(*args, **kwargs): return spectral_norm(nn.Conv2d(*args, **kwargs)) def convTranspose...
10,639
30.111111
117
py
chaoda
chaoda-master/comparisons/against_pyod.py
import signal import time from typing import List import numpy from pyod.models import abod from pyod.models import auto_encoder from pyod.models import cblof from pyod.models import cof from pyod.models import hbos from pyod.models import iforest from pyod.models import knn from pyod.models import lmdd from pyod.mode...
5,715
34.949686
140
py
InstMatt
InstMatt-main/main.py
import os import toml import argparse from pprint import pprint import torch from torch.utils.data import DataLoader import utils from utils import CONFIG from dataloader.offline_image_file import CustomImageFileTrain, CustomImageFileTest from dataloader.prefetcher import Prefetcher def main(args): if args.sta...
5,115
40.593496
96
py
InstMatt
InstMatt-main/trainer_stage1.py
import os import numpy as np import random import cv2 import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils as nn_utils import torch.backends.cudnn as cudnn from torch.nn import SyncBatchNorm import torch.optim.lr_scheduler as lr_scheduler from torch.nn.parallel import Distribute...
33,595
47.619392
164
py
InstMatt
InstMatt-main/trainer_stage2.py
import os import numpy as np import random import cv2 import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils as nn_utils import torch.backends.cudnn as cudnn from torch.nn import SyncBatchNorm import torch.optim.lr_scheduler as lr_scheduler from torch.nn.parallel import Distribute...
34,418
47.341292
164
py
InstMatt
InstMatt-main/infer.py
import os import cv2 import toml import argparse import numpy as np import time import tqdm import torch from torch.nn import functional as F import utils from utils import CONFIG import networks from scipy.ndimage import morphology def dilate(mask, t=20): unknown = morphology.distance_transform_edt(mask==0) ...
8,751
38.60181
154
py
InstMatt
InstMatt-main/evaluation/metrics.py
import os import cv2 import numpy as np import torch import torch.nn as nn import math import time import skimage.measure import torch.nn.functional as F from PIL import Image from scipy import ndimage from scipy.ndimage.morphology import distance_transform_edt from multiprocessing import Pool def findMaxConnectedRe...
9,128
37.682203
116
py
InstMatt
InstMatt-main/networks/generators.py
import torch import torch.nn as nn from utils import CONFIG, concat_all_gather, group_reduce_sum, reduce_dict, reduce_list from networks import encoders, decoders, refiners, ops class Generator(nn.Module): def __init__(self, cfg, encoder, decoder, cross_head=False, refiner=None): super(Generator, self)._...
2,121
35.586207
87
py
InstMatt
InstMatt-main/networks/ops.py
import torch from torch import nn from torch.nn import Parameter from torch.autograd import Variable from torch.nn import functional as F def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): """ Based on https://github.com/heykeetae/Self-Attention-GAN/blob/ma...
4,983
35.647059
110
py
InstMatt
InstMatt-main/networks/decoders/res_shortcut_dec.py
from networks.decoders.resnet_dec import ResNet_D_Dec, ResNet_D_Dec_Color import torch import torch.nn as nn import torch.nn.functional as F class ResShortCut_D_Dec(ResNet_D_Dec): def __init__(self, block, layers, out_channel=1, norm_layer=None, large_kernel=False, late_downsample=False, act_func='tanh'): ...
5,164
32.322581
140
py
InstMatt
InstMatt-main/networks/decoders/resnet_dec.py
import logging import torch.nn as nn from networks.ops import SpectralNorm import torch import torch.nn as nn import torch.nn.functional as F def conv5x5(in_planes, out_planes, stride=1, groups=1, dilation=1): """5x5 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=5, stride=st...
13,034
40.512739
125
py
InstMatt
InstMatt-main/networks/encoders/res_shortcut_enc.py
import torch.nn as nn from utils import CONFIG from networks.encoders.resnet_enc import ResNet_D from networks.ops import SpectralNorm class ResShortCut_D(ResNet_D): def __init__(self, block, layers, norm_layer=None, late_downsample=False): super(ResShortCut_D, self).__init__(block, layers, norm_la...
1,992
36.603774
103
py
InstMatt
InstMatt-main/networks/encoders/__init__.py
import logging from .resnet_enc import ResNet_D, BasicBlock from .res_shortcut_enc import ResShortCut_D __all__ = ['res_shortcut_encoder_29'] def _res_shortcut_D(block, layers, **kwargs): model = ResShortCut_D(block, layers, **kwargs) return model def res_shortcut_encoder_29(**kwargs): """Constructs a...
737
25.357143
95
py
InstMatt
InstMatt-main/networks/encoders/resnet_enc.py
import logging import torch.nn as nn from utils import CONFIG from networks.ops import SpectralNorm def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dila...
5,808
36.96732
118
py
InstMatt
InstMatt-main/networks/refiners/refiner.py
import torch import torch.nn as nn import torch.nn.functional as F import random import numpy as np class MultiInstRefiner(nn.Module): def __init__(self, inc, ouc=32): super(MultiInstRefiner, self).__init__() self.leaky_relu = nn.LeakyReLU(0.2, inplace=True) norm_layer = nn.BatchNorm2d ...
10,009
42.333333
131
py
InstMatt
InstMatt-main/utils/logger.py
import os import cv2 import torch import logging import datetime import numpy as np from pprint import pprint from utils import util from utils.config import CONFIG from tensorboardX import SummaryWriter LEVELS = { "DEBUG": logging.DEBUG, "INFO": logging.INFO, "WARNING": logging.WARNING, "ERRO...
8,889
33.59144
130
py
InstMatt
InstMatt-main/utils/util.py
import os import cv2 import torch import logging import numpy as np from utils.config import CONFIG import torch.distributed as dist import torch.nn.functional as F from skimage.measure import label from collections import OrderedDict def make_dir(target_dir): """ Create dir if not exists """ if not os...
10,780
32.58567
115
py
InstMatt
InstMatt-main/dataloader/offline_image_file.py
import os import glob import logging import functools import numpy as np import torch class ImageFile(object): def __init__(self, phase='train'): self.logger = logging.getLogger("Logger") self.phase = phase self.rng = np.random.RandomState(0) def _get_valid_names(self, *dirs, shuffle=...
8,207
33.343096
133
py
InstMatt
InstMatt-main/dataloader/data_generator.py
import cv2 import os import math import numbers import random import logging import numpy as np import imgaug.augmenters as iaa import torch from torch.utils.data import Dataset from torch.nn import functional as F from torchvision import transforms from utils import CONFIG interp_list = [cv2.INTER_NEAREST, ...
28,611
40.168345
141
py
InstMatt
InstMatt-main/dataloader/prefetcher.py
import torch class Prefetcher(): """ Modified from the data_prefetcher in https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py """ def __init__(self, loader): self.orig_loader = loader self.stream = torch.cuda.Stream() self.next_sample = None def preloa...
1,461
33
113
py
InstMatt
InstMatt-main/dataloader/offline_data_generator_stage2.py
import cv2 import os import math import numbers import random import logging import numpy as np import imgaug.augmenters as iaa import torch from torch.utils.data import Dataset from torch.nn import functional as F from torchvision import transforms from utils import CONFIG, normalize_image interp_list = [cv2.INTER_...
30,695
40.593496
150
py
InstMatt
InstMatt-main/dataloader/offline_data_generator_stage1.py
import cv2 import os import math import numbers import random import logging import numpy as np import imgaug.augmenters as iaa import torch from torch.utils.data import Dataset from torch.nn import functional as F from torchvision import transforms from utils import CONFIG, normalize_image interp_list = [cv2.INTER_...
30,195
40.649655
150
py
TextING
TextING-master/layers.py
from inits import * import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS # global unique layer ID dictionary for layer name assignment _LAYER_UIDS = {} def get_layer_uid(layer_name=''): """Helper function, assigns unique layer IDs.""" if layer_name not in _LAYER_UIDS: _LAYER_UIDS[layer_n...
9,816
33.566901
92
py
Deep-sr-DDL
Deep-sr-DDL-master/main.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 13:00:34 2020 @author: niharika-shimona """ import sys import numpy as np import os # torch import torch import pickle #scipy import scipy.io as sio #Matplotlib import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt #my libs from Alternating...
4,517
29.12
150
py
Deep-sr-DDL
Deep-sr-DDL-master/Helpers.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 12:07:46 2020 @author: niharika-shimona """ import torch import numpy as np ############################################################################### "Helper functions for main optimization modules" def corr_preprocess(corr_train_np,corr_test_np): ...
5,691
31.712644
141
py
Deep-sr-DDL
Deep-sr-DDL-master/Alternating_Minimization.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 12:25:43 2020 @author: niharika-shimona """ import torch from torch.autograd import Variable from copy import copy import numpy as np import time #Parallel Processing from joblib import Parallel, delayed #my libs from Optimization_Modules import update_basis, trai...
3,715
29.211382
207
py
Deep-sr-DDL
Deep-sr-DDL-master/LSTM_ANN.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 18:11:31 2020 @author: niharika-shimona """ # torch import torch from torch import nn from torch.autograd import Variable class LSTM_ANN(nn.Module): def __init__(self, num_targets, input_size, hidden_size, num_layers): super(LSTM_ANN, self).__init__(...
2,628
31.8625
90
py
Deep-sr-DDL
Deep-sr-DDL-master/Optimization_Modules.py
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 11:03:27 2020 @author: niharika-shimona """ #torch libs import torch from torch.autograd import Variable import numpy as np from copy import copy from Helpers import loss_regularize def update_basis(B,corr,L,C,D,lamb,lambda_1): "update the basis term B" ...
7,266
34.975248
148
py
Deep-sr-DDL
Deep-sr-DDL-master/Quadratic_Solver.py
# -*- coding: utf-8 -*- """ Created on Tue Aug 18 18:33:42 2020 @author: niharika-shimona """ #torch libs import torch from torch import optim import numpy as np #scipy libs import scipy from scipy import optimize def func(params, *args): #quadratic objective definition H_n...
2,584
26.210526
134
py
morphological-BERT
morphological-BERT-master/setup.py
""" Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py To create the package for pypi. 1. Change the version in __init__.py and setup.py. 2. Commit these changes with the message: "Release: VERSION" 3. Add a tag in git to mark the release: "git tag VERSION -m'Adds tag VER...
2,798
37.875
104
py
morphological-BERT
morphological-BERT-master/run_ud_cross_validation.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
66,952
39.115638
199
py
morphological-BERT
morphological-BERT-master/run_ner_cross_validation.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
65,256
39.456913
199
py
morphological-BERT
morphological-BERT-master/examples/run_lm_finetuning.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...
27,905
42.198142
139
py
morphological-BERT
morphological-BERT-master/examples/run_gpt2.py
#!/usr/bin/env python3 import argparse import logging from tqdm import trange import torch import torch.nn.functional as F import numpy as np from pytorch_pretrained_bert import GPT2LMHeadModel, GPT2Tokenizer logging.basicConfig(format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s', ...
4,482
39.026786
136
py
morphological-BERT
morphological-BERT-master/examples/run_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...
6,647
42.45098
111
py
morphological-BERT
morphological-BERT-master/examples/run_squad.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...
49,767
44.869124
141
py
morphological-BERT
morphological-BERT-master/examples/run_classifier.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
40,714
41.948312
144
py
morphological-BERT
morphological-BERT-master/examples/run_swag.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...
23,954
42.713504
139
py
morphological-BERT
morphological-BERT-master/examples/extract_features.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...
12,206
39.963087
120
py
morphological-BERT
morphological-BERT-master/examples/count_slovene_words_in_dictionary.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
32,012
41.177866
139
py
morphological-BERT
morphological-BERT-master/examples/run_ner.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
42,736
42.168687
271
py
morphological-BERT
morphological-BERT-master/examples/run_openai_gpt.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,242
48.230483
132
py
morphological-BERT
morphological-BERT-master/examples/run_lm_finetuning_word_type.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. # Modifications copyright (C) 2019 Embeddia project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
31,906
42.234417
139
py
morphological-BERT
morphological-BERT-master/examples/preprocess.py
import pandas as pd from pytorch_pretrained_bert import BasicTokenizer def modify_df(df, tokenizer): df['Data'] = df.apply(lambda x: ' '.join(tokenizer.tokenize(x['Data'])), axis=1) return df def clean_sentences(): train_df = pd.read_csv('../../comments_sentiment/data/train.tsv', sep='\t', index_col=0)...
968
34.888889
92
py
morphological-BERT
morphological-BERT-master/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,596
38.255708
110
py
morphological-BERT
morphological-BERT-master/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 ...
3,352
35.846154
95
py
morphological-BERT
morphological-BERT-master/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 ...
9,068
39.668161
130
py
morphological-BERT
morphological-BERT-master/tests/modeling_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 ...
13,258
42.903974
137
py
morphological-BERT
morphological-BERT-master/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 ...
1,821
34.72549
93
py
morphological-BERT
morphological-BERT-master/tests/tokenization_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 ...
4,268
34.280992
89
py
morphological-BERT
morphological-BERT-master/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 ...
8,458
39.090047
133
py
morphological-BERT
morphological-BERT-master/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,174
37.157895
94
py
morphological-BERT
morphological-BERT-master/pytorch_pretrained_bert/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...
7,887
42.822222
141
py
morphological-BERT
morphological-BERT-master/pytorch_pretrained_bert/optimization_openai.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 # # ...
6,714
40.708075
143
py
morphological-BERT
morphological-BERT-master/pytorch_pretrained_bert/__main__.py
# coding: utf8 def main(): import sys if (len(sys.argv) != 4 and len(sys.argv) != 5) or sys.argv[1] not in [ "convert_tf_checkpoint_to_pytorch", "convert_openai_checkpoint", "convert_transfo_xl_checkpoint", "convert_gpt2_checkpoint", ]: print( "Should be used ...
4,393
51.309524
145
py
morphological-BERT
morphological-BERT-master/pytorch_pretrained_bert/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,017
40.342466
111
py