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
ssl-chewing
ssl-chewing-master/src/dataset/template/basesubset.py
from abc import ABC, abstractmethod from typing import Union, List, Tuple, NoReturn, Optional from warnings import warn import numpy as np from tensorflow.keras.utils import Sequence from dataset.commons import SubsetType from dataset.template.commons import PureAbstractError from utilities.matlabutils import strcmp,...
9,286
43.014218
120
py
ssl-chewing
ssl-chewing-master/src/utilities/kerasutils.py
from typing import List from tensorflow import Tensor, is_tensor from tensorflow.python.keras.engine.base_layer import Layer from utilities.typingutils import is_typed_list def apply_block(block: List[Layer], input_tensor: Tensor) -> Tensor: """ Apply a block of layers to an input tensor. :param block:...
682
26.32
79
py
ssl-chewing
ssl-chewing-master/src/simclr/simclrhelper.py
from pathlib import Path from typing import List, NoReturn, Optional from tensorflow import is_tensor from tensorflow.keras.layers import Layer, Input from tensorflow.keras.models import Model import globalconfig as g_conf from utilities.kerasutils import apply_block from utilities.typingutils import is_typed_list ...
3,841
39.020833
111
py
ssl-chewing
ssl-chewing-master/src/simclr/warmupandcosinedecay.py
import math import tensorflow as tf from tensorflow import Tensor from tensorflow.keras.experimental import CosineDecay from tensorflow.keras.optimizers.schedules import LearningRateSchedule class WarmUpAndCosineDecay(LearningRateSchedule): """Applies a warmup schedule on a given learning rate decay schedule."""...
2,250
42.288462
110
py
ssl-chewing
ssl-chewing-master/src/simclr/contrastiveloss.py
import tensorflow as tf from tensorflow import Tensor from tensorflow.keras.losses import categorical_crossentropy LARGE_NUM = 1e9 def __contrastive_loss(hidden, hidden_norm: bool = True, temperature: float = 1.0, weights: float = 1.0): """ Notes on original method: - hidden: Tensor, shape is (1024, 128)...
2,789
40.641791
116
py
ssl-chewing
ssl-chewing-master/src/optimizer/larsoptimizer.py
# coding=utf-8 # Copyright 2020 The SimCLR 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 applicable law or...
6,911
39.658824
88
py
ssl-chewing
ssl-chewing-master/src/model/papapanagiotou2017convolutional.py
""" Models from the paper: https://ieeexplore.ieee.org/document/8037060/ """ from typing import List from tensorflow.keras.activations import relu, sigmoid, softmax from tensorflow.keras.layers import Layer, Conv1D, MaxPool1D, Dense, Dropout, Flatten from utilities.typingutils import is_typed_list def _is_list_of_...
2,257
30.361111
112
py
ssl-chewing
ssl-chewing-master/src/model/simclrprojectionhead.py
""" A few projection head templates from: https://github.com/google-research/simclr """ from typing import List from tensorflow.keras.activations import relu, linear from tensorflow.keras.layers import Layer, Dense def linear_projection_head(projection_dim: int) -> List[Layer]: """ A dense layer with no bias...
1,709
37.863636
118
py
FogRemoval
FogRemoval-main/losses.py
import torch from torch import nn from torchvision.models.vgg import vgg16, vgg19 from modules import SimpleGray class PixelwiseLoss(nn.Module): """ It is just a simple MSE loss assuming input in range [-1, 1] """ def __init__(self, is_gray=False): super(PixelwiseLoss, self).__init__() ...
18,620
36.242
133
py
FogRemoval
FogRemoval-main/test.py
import argparse import os from os import makedirs, listdir from os.path import join, isfile, basename, exists from math import ceil from PIL import Image import PIL import torch import torchvision.transforms as transforms from tqdm import tqdm from networks import GenerativeModel from utils import get_config from modul...
3,733
27.287879
140
py
FogRemoval
FogRemoval-main/modules.py
import torch from torch import nn import torch.nn.functional as F import numpy as np from torch.autograd import Variable def CircularGaussKernel(kernlen=None, circ_zeros=False, sigma=None, norm=True): assert ((kernlen is not None) or sigma is not None) if kernlen is None: kernlen = int(2.0 * 3.0 * sigm...
2,391
30.064935
88
py
FogRemoval
FogRemoval-main/SRDefog_test.py
import time, itertools from dataset import ImageFolder from torchvision import transforms from torch.utils.data import DataLoader from networks import * from utils import * from glob import glob from PIL import Image from cv2 import resize class SRDefog(object) : def __init__(self, args): self.mode...
4,584
44.39604
148
py
FogRemoval
FogRemoval-main/utils.py
import os, cv2, torch import random import shutil import torch import torchvision import yaml import ramps from scipy import misc import numpy as np def get_config(config): with open(config, 'r') as stream: return yaml.load(stream) def write_grid_grid(list_of_tensor, grid_batch_size=None, filename=None, ...
7,119
31.66055
111
py
FogRemoval
FogRemoval-main/data_utils.py
from os import listdir from os.path import join, isfile import numbers, random from PIL import Image import numpy as np import torch from torch.utils.data import DataLoader, Subset from torch.utils.data.dataset import Dataset, ConcatDataset from torch.utils.data.sampler import BatchSampler, Sampler from torchvision.tra...
8,521
34.656904
129
py
FogRemoval
FogRemoval-main/dataset.py
import torch.utils.data as data from PIL import Image import os import os.path def has_file_allowed_extension(filename, extensions): """Checks if a file is an allowed extension. Args: filename (string): path to a file Returns: bool: True if the filename ends with a known image extensio...
3,479
30.926606
110
py
FogRemoval
FogRemoval-main/networks.py
import torch import torch.nn as nn from torch.nn import init from torch.optim import lr_scheduler from torch.nn.parameter import Parameter import functools from random import getrandbits from modules import SimpleGray, GaussianBlur, RGB2Saturation from losses import GANLoss import torch.nn.functional as F ############...
64,397
42.133289
175
py
FogRemoval
FogRemoval-main/metrics.py
from math import exp, log10 import torch import torch.nn.functional as F from torch import nn from torch.autograd import Variable from losses import PerceptualLoss class ImageReconstructionError(nn.Module): def __init__(self, metrics=['psnr', 'ssim']): super(ImageReconstructionError, self).__init__() ...
4,497
35.274194
114
py
FogRemoval
FogRemoval-main/model_vit/contra_loss.py
import torch from torch import nn from torch.nn import functional as F class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1. / self.power) out = x....
2,904
33.176471
95
py
FogRemoval
FogRemoval-main/model_vit/model.py
import torch from . import networks class Model(torch.nn.Module): def __init__(self, cfg): super().__init__() device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') self.netG = networks.define_G(cfg['init_type'], cfg['init_gain']).to(device) self.cfg = cfg def fo...
820
33.208333
98
py
FogRemoval
FogRemoval-main/model_vit/networks.py
from torch.nn import init from torch.optim import lr_scheduler from models.unet.skip import skip def get_scheduler(optimizer, opt): if opt.lr_policy == 'linear': def lambda_rule(epoch): lr_l = 1.0 - max(0, epoch + opt.epoch_count - opt.n_epochs) / float(opt.n_epochs_decay + 1) retu...
2,636
43.694915
116
py
FogRemoval
FogRemoval-main/model_vit/extractor.py
import torch def attn_cosine_sim(x, eps=1e-08): x = x[0] norm1 = x.norm(dim=2, keepdim=True) factor = torch.clamp(norm1 @ norm1.permute(0, 2, 1), min=eps) sim_matrix = (x @ x.permute(0, 2, 1)) / factor return sim_matrix class VitExtractor: BLOCK_KEY = 'block' ATTN_KEY = 'attn' PATCH_IM...
6,535
38.373494
112
py
FogRemoval
FogRemoval-main/model_vit/loss_vit.py
from torchvision.transforms import Resize from torchvision import transforms import torch import torch.nn.functional as F import torch.nn as nn from model_vit.extractor import VitExtractor from model_vit.contra_loss import PatchLoss,ConstLoss device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') class...
5,711
44.333333
112
py
FogRemoval
FogRemoval-main/model_vit/unet/downsampler.py
import numpy as np import torch import torch.nn as nn class Downsampler(nn.Module): ''' http://www.realitypixels.com/turk/computergraphics/ResamplingFilters.pdf ''' def __init__(self, n_planes, factor, kernel_type, phase=0, kernel_width=None, support=None, sigma=None, preserve_size=False): ...
5,379
30.83432
129
py
FogRemoval
FogRemoval-main/model_vit/unet/common.py
import torch import torch.nn as nn import numpy as np from .downsampler import Downsampler def add_module(self, module): self.add_module(str(len(self) + 1), module) torch.nn.Module.add = add_module class Concat(nn.Module): def __init__(self, dim, *args): super(Concat, self).__init__() sel...
3,531
27.483871
128
py
favtGAN
favtGAN-main/favtGAN/favtGAN/test.py
import argparse import os import numpy as np import math import itertools import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable #from mod...
8,612
34.8875
139
py
favtGAN
favtGAN-main/favtGAN/favtGAN/favtgan-noisy-label.py
import argparse import os import numpy as np import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from datasets import * import torch.nn as ...
15,858
36.849642
125
py
favtGAN
favtGAN-main/favtGAN/favtGAN/favtgan-gaussian.py
import argparse import os import numpy as np import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from datasets import * import torch.nn as ...
17,383
37.375276
179
py
favtGAN
favtGAN-main/favtGAN/favtGAN/datasets.py
import glob import random import os import numpy as np import torch import pandas as pd from torch.utils.data import Dataset from PIL import Image import torchvision.transforms as transforms #I added attributes=None class ImageDataset(Dataset): def __init__(self, annots_csv, root, transforms_=None, mode="train"):...
2,587
34.452055
85
py
favtGAN
favtGAN-main/favtGAN/favtGAN/favtgan-no-noise.py
import argparse import os import numpy as np import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from datasets import * import torch.nn as ...
17,779
38.599109
179
py
favtGAN
favtGAN-main/favtGAN/favtGAN/favtgan-baseline.py
import argparse import os import numpy as np import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from datasets import * import torch.nn as ...
16,687
37.809302
125
py
favtGAN
favtGAN-main/favtGAN/pix2pix/test.py
import argparse import os import numpy as np import math import itertools import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from mode...
4,027
39.686869
128
py
favtGAN
favtGAN-main/favtGAN/pix2pix/datasets.py
import glob import random import os import numpy as np from torch.utils.data import Dataset from PIL import Image import torchvision.transforms as transforms class ImageDataset(Dataset): def __init__(self, root, transforms_=None, mode="train"): self.transform = transforms.Compose(transforms_) se...
1,669
27.793103
85
py
favtGAN
favtGAN-main/favtGAN/pix2pix/models.py
import torch.nn as nn import torch.nn.functional as F import torch def weights_init_normal(m): classname = m.__class__.__name__ if classname.find("Conv") != -1: torch.nn.init.normal_(m.weight.data, 0.0, 0.02) elif classname.find("BatchNorm2d") != -1: torch.nn.init.normal_(m.weight.data, 1....
4,712
32.190141
81
py
favtGAN
favtGAN-main/favtGAN/pix2pix/pix2pix-smooth.py
import argparse import os import numpy as np import math import itertools import time import datetime import sys import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable from model...
8,284
33.957806
142
py
LightSKD
LightSKD-master/main.py
import os from torch import nn, optim from datasets import get_trainloader as tl, get_testloader as tel from backbone.resnet import ResNet18,ResNet50,ResNet101 from backbone.adapter import adapter_2 from backbone.mobilenetv2 import * import torch.nn.functional as F import argparse parser = argparse.ArgumentParser(des...
5,324
31.87037
135
py
LightSKD
LightSKD-master/utils.py
import torch from backbone.resnet import * from backbone.ResNeXt import resnext50_32x4d from backbone.densenet import densenet121 as densenet121 def output_process(output): return torch.sort(output)[0] def params_detection(net): stat = net.state_dict() for k, v in stat.items(): try: pr...
1,951
29.030769
61
py
LightSKD
LightSKD-master/datasets.py
import random from collections import defaultdict import torch import matplotlib.pyplot as plt import torchvision import numpy as np import seaborn as sns import pandas as pd import numpy import math from backbone.resnet import * import torchvision.transforms as transforms, torchvision.datasets as datasets from torchvi...
9,393
36.277778
116
py
LightSKD
LightSKD-master/train.py
import os import time import numpy as np import torch torch.set_printoptions(threshold=np.inf) from torch.nn import DataParallel from torch import nn, optim from datasets import get_trainloader as tl, get_testloader as tel, get_single_val_loader as svl from backbone.adapter import adapter_2 from backbone.mobilenetv2 i...
6,844
36.404372
124
py
LightSKD
LightSKD-master/backbone/ResNeXt.py
import torch.nn as nn import torch.utils.model_zoo as model_zoo import torch.nn.functional as F from torchvision.models import resnet18 __all__ = ['ResNet', 'resnet18', 'resnext50_32x4d'] model_urls = { 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', 'resnet34': 'https://download.pyto...
6,835
34.978947
106
py
LightSKD
LightSKD-master/backbone/resnet.py
'''ResNet in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch.nn as nn import torch.nn.functional as F from torchvision.models import resnet50 __all__ = ['Re...
4,398
34.475806
116
py
LightSKD
LightSKD-master/backbone/mobilenetv2.py
from typing import List import torch.nn as nn import torch def _make_divisible(v: float, divisor: int, min_value=None) -> int: """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://github.com/tensor...
5,906
35.018293
121
py
LightSKD
LightSKD-master/backbone/adapter.py
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): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False) ...
6,546
32.747423
134
py
LightSKD
LightSKD-master/backbone/mlp.py
import torch import torch.nn as nn class MLP(nn.Module): def __init__(self,num_classes=100): super(MLP, self).__init__() self.model = nn.Sequential( nn.Linear(num_classes,256), nn.BatchNorm1d(256), nn.LeakyReLU(), nn.Linear(256,128), nn.Ba...
537
24.619048
39
py
LightSKD
LightSKD-master/backbone/densenet.py
import re import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from collections import OrderedDict # from .utils import load_state_dict_from_url try: from torch.hub import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as...
11,265
44.983673
118
py
irfu-python
irfu-python-master/docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # Built-in imports import os import shutil import sys # 3rd party imports import pydat...
8,698
28.68942
83
py
side
side-main/projects/verify_wikipedia/evaluation/retrievers/reranker.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import logging import os.path from collections import OrderedDict from pathlib import Path import torch import json import ...
13,001
40.407643
126
py
side
side-main/projects/verify_wikipedia/dpr/options.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Command line arguments utils """ import json import logging import random import numpy as np im...
2,292
26.626506
108
py
side
side-main/projects/verify_wikipedia/dpr/dense_retriever.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Command line tool to get dense results and validate them """ import logging import pickle impo...
10,487
33.162866
119
py
side
side-main/projects/verify_wikipedia/dpr/dataset/training.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import logging import os import random import socket import tempfile from typing import List, Union import filelock import...
12,547
35.905882
118
py
side
side-main/projects/verify_wikipedia/dpr/dataset/retrieval.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import collections import csv import logging import os import pickle import sys import zlib from pathlib import Path from t...
7,955
30.951807
108
py
side
side-main/projects/verify_wikipedia/dpr/dataset/input_transform.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import collections import json import logging from typing import List import torch from dpr.dataset.utils import normaliz...
12,425
36.092537
120
py
side
side-main/projects/verify_wikipedia/dpr/models/hf_models.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Encoder model wrappers based on HuggingFace code """ import logging from typing import Tuple, L...
23,576
38.426421
120
py
side
side-main/projects/verify_wikipedia/dpr/models/reranker.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ BiEncoder component + loss function for 'all-in-batch' training """ import logging from typing ...
6,486
32.096939
113
py
side
side-main/projects/verify_wikipedia/dpr/models/ranker_loss.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Tuple import torch import torch.nn.functional as F from torch imp...
12,576
41.063545
125
py
side
side-main/projects/verify_wikipedia/dpr/models/biencoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ BiEncoder component + loss function for 'all-in-batch' training """ import collections import lo...
5,024
30.21118
113
py
side
side-main/projects/verify_wikipedia/dpr/utils/model_utils.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import collections import glob import logging import os from typing import List import torch from t...
4,681
28.821656
110
py
side
side-main/projects/verify_wikipedia/dpr/utils/dist_utils.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Utilities for distributed model training """ import logging import os import pickle import socke...
7,902
33.662281
119
py
side
side-main/projects/verify_wikipedia/dpr/utils/data_utils.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Utilities for general purpose data processing """ import itertools import json import logging im...
15,101
33.717241
117
py
DMCMC
DMCMC-main/losses.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
8,332
38.492891
115
py
DMCMC
DMCMC-main/utils.py
import torch import tensorflow as tf import os import logging def restore_checkpoint(ckpt_dir, state, device): if not tf.io.gfile.exists(ckpt_dir): tf.io.gfile.makedirs(os.path.dirname(ckpt_dir)) logging.warning(f"No checkpoint found at {ckpt_dir}. " f"Returned the same state as input") ...
909
30.37931
71
py
DMCMC
DMCMC-main/sampling.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
17,416
35.134855
116
py
DMCMC
DMCMC-main/datasets.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
7,244
35.77665
99
py
DMCMC
DMCMC-main/sde_lib.py
"""Abstract SDE classes, Reverse SDE, and VE/VP SDEs.""" import abc import torch import numpy as np class SDE(abc.ABC): """SDE abstract class. Functions are designed for a mini-batch of inputs.""" def __init__(self, N): """Construct an SDE. Args: N: number of discretization time steps. """ ...
7,637
28.719844
153
py
DMCMC
DMCMC-main/models/up_or_down_sampling.py
"""Layers used for up-sampling or down-sampling images. Many functions are ported from https://github.com/NVlabs/stylegan2. """ import torch.nn as nn import torch import torch.nn.functional as F import numpy as np from op import upfirdn2d # Function ported from StyleGAN2 def get_weight(module, shape,...
8,900
33.5
91
py
DMCMC
DMCMC-main/models/utils.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
5,695
29.297872
105
py
DMCMC
DMCMC-main/models/layers.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
22,687
33.271903
112
py
DMCMC
DMCMC-main/models/ddpm.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
6,082
32.423077
113
py
DMCMC
DMCMC-main/models/ncsnv2.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
16,043
37.567308
120
py
DMCMC
DMCMC-main/models/normalization.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
7,657
34.453704
106
py
DMCMC
DMCMC-main/models/ema.py
# Modified from https://raw.githubusercontent.com/fadel/pytorch_ema/master/torch_ema/ema.py from __future__ import division from __future__ import unicode_literals import torch # Partially based on: https://github.com/tensorflow/tensorflow/blob/r1.13/tensorflow/python/training/moving_averages.py class ExponentialMo...
3,414
33.846939
119
py
DMCMC
DMCMC-main/models/ncsnpp.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
13,653
34.743455
113
py
DMCMC
DMCMC-main/models/layerspp.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
9,001
31.734545
99
py
DMCMC
DMCMC-main/configs/default_cifar10_configs.py
import ml_collections import torch def get_default_configs(): config = ml_collections.ConfigDict() # training config.training = training = ml_collections.ConfigDict() config.training.batch_size = 128 training.n_iters = 1300001 training.snapshot_freq = 50000 training.log_freq = 50 training.eval_freq = ...
1,975
26.068493
94
py
DMCMC
DMCMC-main/configs/default_celeba_configs.py
import ml_collections import torch def get_default_configs(): config = ml_collections.ConfigDict() # training config.training = training = ml_collections.ConfigDict() config.training.batch_size = 128 training.n_iters = 1300001 training.snapshot_freq = 50000 training.log_freq = 50 training.eval_freq = ...
1,947
26.055556
94
py
DMCMC
DMCMC-main/configs/default_lsun_configs.py
import ml_collections import torch def get_default_configs(): config = ml_collections.ConfigDict() # training config.training = training = ml_collections.ConfigDict() config.training.batch_size = 64 training.n_iters = 2400001 training.snapshot_freq = 50000 training.log_freq = 50 training.eval_freq = 1...
1,944
26.013889
94
py
DMCMC
DMCMC-main/configs/ve/ffhq_ncsnpp_continuous.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
3,229
28.099099
94
py
DMCMC
DMCMC-main/configs/ve/celebahq_ncsnpp_continuous.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
3,184
27.693694
94
py
DMCMC
DMCMC-main/op/losses.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
8,332
38.492891
115
py
DMCMC
DMCMC-main/op/upfirdn2d.py
import os import torch from torch.nn import functional as F from torch.autograd import Function from torch.utils.cpp_extension import load module_path = os.path.dirname(__file__) upfirdn2d_op = load( "upfirdn2d", sources=[ os.path.join(module_path, "upfirdn2d.cpp"), os.path.join(module_path, ...
5,672
27.223881
108
py
DMCMC
DMCMC-main/op/fused_act.py
import os import torch from torch import nn from torch.nn import functional as F from torch.autograd import Function from torch.utils.cpp_extension import load module_path = os.path.dirname(__file__) fused = load( "fused", sources=[ os.path.join(module_path, "fused_bias_act.cpp"), os.path.joi...
2,690
26.459184
83
py
Merak
Merak-main/setup.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: TXacs (txacs1993@gmail.com), Swli (lucasleesw9@gmail.com) # # 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 o...
4,168
32.894309
112
py
Merak
Merak-main/tools/convert_megatron_gpt2_checkpoint.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: TXacs (txacs1993@gmail.com) # # 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:...
30,784
41.57953
172
py
Merak
Merak-main/Merak/merak_trainer.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com), TXacs (txacs1993@gmail.com) # # 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 o...
30,587
43.266281
169
py
Merak
Merak-main/Merak/__init__.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com), TXacs (txacs1993@gmail.com) # # 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 o...
3,218
33.612903
120
py
Merak
Merak-main/Merak/train_func.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: TXacs (txacs1993@gmail.com), Swli (lucasleesw9@gmail.com) # # 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 o...
14,314
41.731343
147
py
Merak
Merak-main/Merak/modules/mp_attrs.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
6,480
40.812903
184
py
Merak
Merak-main/Merak/modules/mp_layers.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
17,194
38.079545
129
py
Merak
Merak-main/Merak/modules/utils.py
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
5,836
31.071429
153
py
Merak
Merak-main/Merak/modules/module.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
27,014
44.403361
167
py
Merak
Merak-main/Merak/modules/layer_proxy.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
9,716
38.987654
122
py
Merak
Merak-main/Merak/modules/transformer_blocks.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
27,453
38.616162
144
py
Merak
Merak-main/Merak/runtime/engine.py
''' Copyright 2019 The Microsoft DeepSpeed Team ''' # https://github.com/microsoft/DeepSpeed/blob/85acf14c58658964a796c5c901b58123f99fb1df/deepspeed/runtime/engine.py import os import stat import math import torch import warnings import hashlib import torch.distributed as dist from collections import OrderedDict from ...
32,047
37.799031
178
py
Merak
Merak-main/Merak/runtime/utils.py
''' Copyright 2019 The Microsoft DeepSpeed Team Copyright NVIDIA/Megatron Helper functions and classes from multiple sources. ''' # https://github.com/microsoft/DeepSpeed/blob/85acf14c58658964a796c5c901b58123f99fb1df/deepspeed/runtime/utils.py import os import psutil import gc import torch from torch._six import inf...
18,063
38.87638
115
py
Merak
Merak-main/Merak/runtime/config.py
""" Copyright (c) Microsoft Corporation Licensed under the MIT license. """ # https://github.com/microsoft/DeepSpeed/blob/85acf14c58658964a796c5c901b58123f99fb1df/deepspeed/runtime/config.py import os from typing import Union import torch import json import copy from .config_utils import get_scalar_param, dict_raise...
20,321
33.620102
128
py
Merak
Merak-main/Merak/runtime/pipe_engine.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com), TXacs (txacs1993@gmail.com) # # 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 o...
57,499
40.307471
159
py
Merak
Merak-main/Merak/runtime/schedule.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
35,103
37.874862
173
py
Merak
Merak-main/Merak/runtime/checkpointing.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
23,186
35.630332
186
py
Merak
Merak-main/Merak/mpu/mappings.py
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
11,917
29.020151
110
py
Merak
Merak-main/Merak/mpu/topology.py
# Copyright 2019 The Microsoft DeepSpeed Team # https://github.com/microsoft/DeepSpeed/blob/85acf14c58658964a796c5c901b58123f99fb1df/deepspeed/runtime/pipe/topology.py from ..utils import logger import torch.distributed as dist import sys from collections import namedtuple from itertools import product as cartesian...
17,384
36.875817
121
py
Merak
Merak-main/Merak/mpu/initialize.py
# coding=utf-8 # Copyright (c) 2022, HPDL group, PDL lab, NUDT. All rights reserved. # # Maintainer: Swli (lucasleesw9@gmail.com) # # 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...
5,420
29.116667
152
py