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
unified-generative-zoo
unified-generative-zoo-main/model/lib/diffusion_stylegan/torch_utils/ops/upfirdn2d.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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 software and rel...
16,287
41.306494
157
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/diffusion_stylegan/torch_utils/ops/conv2d_resample.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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 software and rel...
7,591
47.356688
130
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/diffusion_stylegan/torch_utils/ops/fma.py
# Copyright (c) 2021, NVIDIA CORPORATION. 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 software and rel...
2,034
32.360656
105
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan2/sg2_model.py
import math import random import torch from torch import nn from torch.nn import functional as F from .op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix class PixelNorm(nn.Module): def __init__(self): super().__init__() def forward(self, input): return input * torch.rsqr...
21,708
26.903599
148
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan2/op/conv2d_gradfix.py
import contextlib import warnings import torch from torch import autograd from torch.nn import functional as F enabled = True weight_gradients_disabled = False @contextlib.contextmanager def no_weight_gradients(): global weight_gradients_disabled old = weight_gradients_disabled weight_gradients_disable...
6,379
26.982456
117
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan2/op/upfirdn2d.py
from collections import abc 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"), ...
5,912
27.157143
108
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan2/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...
3,156
25.308333
86
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/main.py
import argparse, os, sys, datetime, glob, importlib, csv import numpy as np import time import torch import torchvision import pytorch_lightning as pl from packaging import version from omegaconf import OmegaConf from torch.utils.data import random_split, DataLoader, Dataset, Subset from functools import partial from ...
28,175
36.973046
140
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/sample_diffusion.py
import argparse, os, sys, glob, datetime, yaml import torch import time import numpy as np from tqdm import trange from omegaconf import OmegaConf from PIL import Image from ldm.models.diffusion.ddim import DDIMSampler from ldm.util import instantiate_from_config rescale = lambda x: (x + 1.) / 2. def custom_to_pil(...
9,570
29.77492
117
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/txt2img.py
import argparse, os, sys, glob import torch import numpy as np from omegaconf import OmegaConf from PIL import Image from tqdm import tqdm, trange from einops import rearrange from torchvision.utils import make_grid from ldm.util import instantiate_from_config from ldm.models.diffusion.ddim import DDIMSampler from ldm...
5,181
29.482353
156
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/notebook_helpers.py
from torchvision.datasets.utils import download_url from ldm.util import instantiate_from_config import torch import os # todo ? from google.colab import files from IPython.display import Image as ipyimg import ipywidgets as widgets from PIL import Image from numpy import asarray from einops import rearrange, repeat im...
10,065
36.559701
138
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/util.py
import importlib import torch import numpy as np from inspect import isfunction from PIL import Image, ImageDraw, ImageFont def log_txt_as_img(wh, xc, size=10): # wh a tuple of (width, height) # xc a list of captions to plot b = len(xc) txts = list() for bi in range(b): txt = Image.new("...
2,442
27.406977
119
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/x_transformer.py
"""shout-out to https://github.com/lucidrains/x-transformers/tree/main/x_transformers""" import torch from torch import nn, einsum import torch.nn.functional as F from functools import partial from inspect import isfunction from collections import namedtuple from einops import rearrange, repeat, reduce # constants DE...
20,168
30.415888
150
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/ema.py
import torch from torch import nn class LitEma(nn.Module): def __init__(self, model, decay=0.9999, use_num_upates=True): super().__init__() if decay < 0.0 or decay > 1.0: raise ValueError('Decay must be between 0 and 1') self.m_name2s_name = {} self.register_buffer('de...
2,982
37.74026
102
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/attention.py
from inspect import isfunction import math import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, repeat from ldm.modules.diffusionmodules.util import checkpoint def exists(val): return val is not None def uniq(arr): return{el: True for el in arr}.keys() d...
8,531
31.689655
122
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/distributions/distributions.py
import torch import numpy as np class AbstractDistribution: def sample(self): raise NotImplementedError() def mode(self): raise NotImplementedError() class DiracDistribution(AbstractDistribution): def __init__(self, value): self.value = value def sample(self): retur...
2,970
30.946237
131
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/image_degradation/bsrgan.py
# -*- coding: utf-8 -*- """ # -------------------------------------------- # Super-Resolution # -------------------------------------------- # # Kai Zhang (cskaizhang@gmail.com) # https://github.com/cszn # From 2019/03--2021/08 # -------------------------------------------- """ import numpy as np import cv2 import tor...
25,198
33.471956
147
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/image_degradation/bsrgan_light.py
# -*- coding: utf-8 -*- import numpy as np import cv2 import torch from functools import partial import random from scipy import ndimage import scipy import scipy.stats as ss from scipy.interpolate import interp2d from scipy.linalg import orth import albumentations import ldm.modules.image_degradation.utils_image as ...
22,238
33.16129
147
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/image_degradation/utils_image.py
import os import math import random import numpy as np import torch import cv2 from torchvision.utils import make_grid from datetime import datetime #import matplotlib.pyplot as plt # TODO: check with Dominik, also bsrgan.py vs bsrgan_light.py os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" ''' # ----------------------...
29,022
30.684498
107
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/encoders/modules.py
import torch import torch.nn as nn from functools import partial from ldm.modules.x_transformer import Encoder, TransformerWrapper # TODO: can we directly rely on lucidrains code and simply add this as a reuirement? --> test class AbstractEncoder(nn.Module): def __init__(self): super().__init__() d...
4,640
34.427481
160
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/diffusionmodules/model.py
# pytorch_diffusion + derived encoder decoder import math import torch import torch.nn as nn import numpy as np from einops import rearrange from ldm.util import instantiate_from_config from ldm.modules.attention import LinearAttention def get_timestep_embedding(timesteps, embedding_dim): """ This matches th...
33,388
38.986826
125
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/diffusionmodules/openaimodel.py
from abc import abstractmethod from functools import partial import math from typing import Iterable import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F from ldm.modules.diffusionmodules.util import ( checkpoint, conv_nd, linear, avg_pool_nd, zero_module, ...
34,953
35.334719
143
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/diffusionmodules/util.py
# adopted from # https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_diffusion.py # and # https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py # and # https://github.com/openai/gu...
9,622
34.906716
164
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/losses/vqperceptual.py
import torch from torch import nn import torch.nn.functional as F from einops import repeat from taming.modules.discriminator.model import NLayerDiscriminator, weights_init from taming.modules.losses.lpips import LPIPS from taming.modules.losses.vqperceptual import hinge_d_loss, vanilla_d_loss def hinge_d_loss_with_...
7,941
46.27381
113
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/modules/losses/contperceptual.py
import torch import torch.nn as nn from taming.modules.losses.vqperceptual import * # TODO: taming dependency yes/no? class LPIPSWithDiscriminator(nn.Module): def __init__(self, disc_start, logvar_init=0.0, kl_weight=1.0, pixelloss_weight=1.0, disc_num_layers=3, disc_in_channels=3, disc_factor=...
5,581
48.839286
128
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/models/autoencoder.py
import torch import pytorch_lightning as pl import torch.nn.functional as F from contextlib import contextmanager from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer from ldm.modules.diffusionmodules.model import Encoder, Decoder from ldm.modules.distributions.distributions import DiagonalGa...
17,598
38.726862
116
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/models/diffusion/ddim.py
"""SAMPLING ONLY.""" import torch import numpy as np from tqdm import tqdm from functools import partial from ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like class DDIMSampler(object): def __init__(self, model, schedule="linear", **kwargs): super()...
11,040
53.122549
131
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/models/diffusion/classifier.py
import os import torch import pytorch_lightning as pl from omegaconf import OmegaConf from torch.nn import functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from copy import deepcopy from einops import rearrange from glob import glob from natsort import natsorted from ldm.modu...
10,150
37.744275
119
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/models/diffusion/ddpm.py
""" wild mixture of https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py https://github.com/openai/improved-diffusion/blob/e94489283bb876ac1477d5dd7709bbbd2d9902ce/improved_diffusion/gaussian_diffusion.py https...
67,109
45.93007
162
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/models/diffusion/plms.py
"""SAMPLING ONLY.""" import torch import numpy as np from tqdm import tqdm from functools import partial from ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like class PLMSSampler(object): def __init__(self, model, schedule="linear", **kwargs): super()...
12,387
51.940171
131
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/data/base.py
from abc import abstractmethod from torch.utils.data import Dataset, ConcatDataset, ChainDataset, IterableDataset class Txt2ImgIterableBaseDataset(IterableDataset): ''' Define an interface to make the IterableDatasets for text2img data chainable ''' def __init__(self, num_records=0, valid_ids=None, si...
693
29.173913
87
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/data/lsun.py
import os import numpy as np import PIL from PIL import Image from torch.utils.data import Dataset from torchvision import transforms class LSUNBase(Dataset): def __init__(self, txt_file, data_root, size=None, interpolation="bicubic", ...
3,274
34.215054
113
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/latentdiff/ldm/data/imagenet.py
import os, yaml, pickle, shutil, tarfile, glob import cv2 import albumentations import PIL import numpy as np import torchvision.transforms.functional as TF from omegaconf import OmegaConf from functools import partial from PIL import Image from tqdm import tqdm from torch.utils.data import Dataset, Subset import tami...
15,497
38.235443
115
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/id_recognition/model_irse.py
from torch.nn import Linear, Conv2d, BatchNorm1d, BatchNorm2d, PReLU, Dropout, Sequential, Module from .helpers import get_blocks, Flatten, bottleneck_IR, bottleneck_IR_SE, l2_norm """ Modified Backbone implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) """ class Backbone(Module): def ...
3,226
36.964706
97
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/id_recognition/helpers.py
from collections import namedtuple import torch from torch.nn import Conv2d, BatchNorm2d, PReLU, ReLU, Sigmoid, MaxPool2d, AdaptiveAvgPool2d, Sequential, Module """ ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) """ class Flatten(Module): def forward(self, input): return inp...
3,556
28.641667
112
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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...
5,643
37.394558
129
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/torch_utils/gen_utils.py
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 from dnnlib.util import open_url # ---------------------------------------------------------------...
23,693
49.520256
161
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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,776
37.644269
144
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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,879
39.546075
133
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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 . import clip from .vit import _make_vit_b16_backbone, forward_vit from .constants import ALL_MODELS, VITS, EFFNETS, REGNETS def _feature_splitter(model, idcs): pretra...
13,316
30.935252
93
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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 norm_wit...
6,242
35.723529
114
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/pg_modules/discriminator.py
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import pickle from ..training.diffaug import DiffAugment from ..training.networks_stylegan2 import FullyConnectedLayer from ..pg_modules.blocks import conv2d, DownBlock, DownBlockPatch from ..pg_modules.projector import F_RandomProj ...
7,163
33.277512
137
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/stylegan_xl/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 convTranspo...
10,641
30.116959
117
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/EMA.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the NVIDIA Source Code License # for Denoising Diffusion GAN. To view a copy of this license, see the LICENSE file. # -----------------------------------------...
3,321
35.505495
107
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/test_ddgan.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the NVIDIA Source Code License # for Denoising Diffusion GAN. To view a copy of this license, see the LICENSE file. # -----------------------------------------...
7,051
34.437186
129
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/discriminator.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the NVIDIA Source Code License # for Denoising Diffusion GAN. To view a copy of this license, see the LICENSE file. # -----------------------------------------...
6,982
28.095833
99
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/up_or_down_sampling.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- """Layers used for up-sampling or down-sampling images. Many functions are ported from https://github.com/NVlabs/stylegan2...
9,541
35.281369
93
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/utils.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file in the Score SDE library # which was released under the Apache License. # # Source: # https://github.com/yang-song/score_sde_pytorch/blob/main/mode...
4,576
29.925676
109
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/dense_layer.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file released under the MIT License. # # Source: # https://github.com/CW-Huang/sdeflow-light/blob/524650bc5ad69522b3e0905672deef0650374512/lib/models/un...
3,234
37.975904
119
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/layers.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file in the Score SDE library # which was released under the Apache License. # # Source: # https://github.com/yang-song/score_sde_pytorch/blob/main/mode...
22,645
35.584814
120
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/ncsnpp_generator_adagn.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file in the Score SDE library # which was released under the Apache License. # # Source: # https://github.com/yang-song/score_sde_pytorch/blob/main/mode...
17,536
39.594907
112
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/models/layerspp.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file in the Score SDE library # which was released under the Apache License. # # Source: # https://github.com/yang-song/score_sde_pytorch/blob/main/mode...
13,736
35.055118
103
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/op/upfirdn2d.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- """ Originated from https://github.com/rosinality/stylegan2-pytorch The license for the original version of this file can be...
6,516
27.836283
108
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/ddgan/score_sde/op/fused_act.py
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- """ Originated from https://github.com/rosinality/stylegan2-pytorch The license for the original version of this file can be...
3,055
27.830189
95
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/legacy.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
16,675
50.153374
154
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/shape_utils.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
4,288
33.58871
124
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/gen_samples.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
10,177
43.060606
258
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/gen_videos.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
16,002
47.789634
268
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/camera_utils.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
6,814
44.738255
142
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/train.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
23,997
59.145363
223
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/calc_metrics.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
8,228
42.08377
154
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/dual_discriminator.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
13,086
51.348
149
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/superresolution.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
15,320
51.469178
140
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/loss.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
18,689
62.788396
456
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/augment.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
26,919
59.904977
366
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/dataset.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
8,881
35.253061
158
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/crosssection_utils.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
1,199
45.153846
154
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/triplane.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
7,562
54.610294
258
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/training_loop.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
24,613
51.933333
178
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/networks_stylegan2.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
40,415
49.773869
164
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/networks_stylegan3.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
26,322
49.816602
141
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/volumetric_rendering/renderer.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
13,212
51.225296
211
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/volumetric_rendering/ray_sampler.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
2,783
43.190476
250
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/volumetric_rendering/ray_marcher.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
2,686
41.650794
147
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/training/volumetric_rendering/math_utils.py
# MIT License # Copyright (c) 2022 Petr Kellnhofer # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
4,708
38.571429
124
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/custom_ops.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
6,780
41.38125
146
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/training_stats.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
10,834
38.98155
118
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/persistence.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
9,866
37.846457
144
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/misc.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
11,220
40.713755
133
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/bias_act.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
9,927
45.830189
185
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/grid_sample_gradfix.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
3,134
38.1875
132
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/conv2d_gradfix.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
9,494
46.475
280
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/upfirdn2d.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
16,506
41.109694
120
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/filtered_lrelu.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
12,998
45.927798
164
py
unified-generative-zoo
unified-generative-zoo-main/model/lib/eg3d/torch_utils/ops/conv2d_resample.py
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NvidiaProprietary # # NVIDIA CORPORATION, its affiliates and licensors retain all intellectual # property and proprietary rights in and to this material, related # documentation ...
6,879
46.123288
130
py