Dataset Viewer
Auto-converted to Parquet Duplicate
python_code
stringlengths
0
1.02M
repo_name
stringlengths
9
48
file_path
stringlengths
5
114
from setuptools import setup, find_packages setup( name = 'Mega-pytorch', packages = find_packages(exclude=[]), version = '0.1.0', license='MIT', description = 'Mega - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', long_description_content_type = 'text/markdown', url = 'https:...
Mega-pytorch-main
setup.py
from mega_pytorch.mega_pytorch import Mega from mega_pytorch.autoregressive_wrapper import AutoregressiveWrapper import argparse import random import tqdm import gzip import numpy as np import torch import torch.optim as optim from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset # co...
Mega-pytorch-main
train.py
import math from functools import partial import torch import torch.nn.functional as F from torch import nn, einsum from torch.fft import rfft, irfft from einops import rearrange from einops.layers.torch import Rearrange from scipy.fftpack import next_fast_len # functions def exists(val): return val is not Non...
Mega-pytorch-main
mega_pytorch/mega_pytorch.py
import torch from torch import nn import torch.nn.functional as F from einops import rearrange # helper function def exists(val): return val is not None def eval_decorator(fn): def inner(model, *args, **kwargs): was_training = model.training model.eval() out = fn(model, *args, **kwar...
Mega-pytorch-main
mega_pytorch/autoregressive_wrapper.py
from mega_pytorch.mega_pytorch import MegaLayer, Mega, MultiHeadedEMA
Mega-pytorch-main
mega_pytorch/__init__.py
import sys from setuptools import setup, find_packages sys.path[0:0] = ['deep_daze'] from version import __version__ setup( name = 'deep-daze', packages = find_packages(), include_package_data = True, entry_points={ 'console_scripts': [ 'imagine = deep_daze.cli:main', ], }, version = __versi...
deep-daze-main
setup.py
__version__ = '0.11.1'
deep-daze-main
deep_daze/version.py
from deep_daze.deep_daze import DeepDaze, Imagine
deep-daze-main
deep_daze/__init__.py
import sys import fire from deep_daze import Imagine def train( text=None, img=None, learning_rate=1e-5, num_layers=16, hidden_size=256, batch_size=4, gradient_accumulate_every=4, epochs=20, iterations=1050, save_every=100, imag...
deep-daze-main
deep_daze/cli.py
import os import subprocess import sys import random from datetime import datetime from pathlib import Path import torch import torch.nn.functional as F from siren_pytorch import SirenNet, SirenWrapper from torch import nn from torch.cuda.amp import GradScaler, autocast from torch_optimizer import DiffGrad, AdamP impo...
deep-daze-main
deep_daze/deep_daze.py
from collections import OrderedDict from typing import Tuple, Union import torch import torch.nn.functional as F from torch import nn from pathlib import Path import hashlib import os import urllib import warnings from typing import Union, List from torchvision.transforms import Compose, Normalize from tqdm import tq...
deep-daze-main
deep_daze/clip.py
from setuptools import setup, find_packages setup( name = 'reformer_pytorch', packages = find_packages(exclude=['examples', 'pretraining']), version = '1.4.4', license='MIT', description = 'Reformer, the Efficient Transformer, Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url =...
reformer-pytorch-master
setup.py
from functools import partial import torch from torch import nn import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence from reformer_pytorch.reformer_pytorch import ReformerLM from reformer_pytorch.autopadder import Autopadder def top_p(logits, thres = 0.9): sorted_logits, sorted_indices = tor...
reformer-pytorch-master
reformer_pytorch/generative_tools.py
import math import torch from torch import nn import torch.nn.functional as F from reformer_pytorch.reformer_pytorch import Reformer, ReformerLM, LSHSelfAttention def pad_to_multiple(tensor, seqlen, multiple, dim=-1): m = seqlen / multiple if m.is_integer(): return tensor remainder = math.ceil(m) ...
reformer-pytorch-master
reformer_pytorch/autopadder.py
import re from torch import nn from reformer_pytorch.reformer_pytorch import ReformerLM from reformer_pytorch.generative_tools import TrainingWrapper ENC_PREFIX = 'enc_' DEC_PREFIX = 'dec_' def group_dict_by_key(cond, d): return_val = [dict(),dict()] for key in d.keys(): match = bool(cond(key)) ...
reformer-pytorch-master
reformer_pytorch/reformer_enc_dec.py
import torch import torch.nn as nn from torch.autograd.function import Function from torch.utils.checkpoint import get_device_states, set_device_states # following example for saving and setting rng here https://pytorch.org/docs/stable/_modules/torch/utils/checkpoint.html class Deterministic(nn.Module): def __init...
reformer-pytorch-master
reformer_pytorch/reversible.py
from torch import nn from reformer_pytorch.reformer_pytorch import LSHAttention, LSHSelfAttention from collections import defaultdict class Recorder(nn.Module): def __init__(self, net): super().__init__() self.iter = 0 self.recordings = defaultdict(list) self.net = net self....
reformer-pytorch-master
reformer_pytorch/recorder.py
from reformer_pytorch.reformer_pytorch import LSHAttention, LSHSelfAttention, Reformer, ReformerLM from reformer_pytorch.reformer_enc_dec import ReformerEncDec from reformer_pytorch.recorder import Recorder from reformer_pytorch.autopadder import Autopadder
reformer-pytorch-master
reformer_pytorch/__init__.py
import math import torch import torch.nn as nn from torch.nn import Identity import torch.nn.functional as F from torch.autograd import Function from functools import partial, reduce, wraps from itertools import chain from operator import mul from local_attention import LocalAttention from axial_positional_embedding i...
reformer-pytorch-master
reformer_pytorch/reformer_pytorch.py
import deepspeed from reformer_pytorch import ReformerLM from reformer_pytorch.generative_tools import TrainingWrapper import argparse import random import tqdm import gzip import numpy as np import torch import torch.optim as optim from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset...
reformer-pytorch-master
examples/enwik8_deepspeed/train.py
from reformer_pytorch import ReformerLM from reformer_pytorch.generative_tools import TrainingWrapper import random import tqdm import gzip import numpy as np import torch import torch.optim as optim from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset # constants NUM_BATCHES = int(1...
reformer-pytorch-master
examples/enwik8_simple/train.py
import re import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader, random_split from tqdm import tqdm from reformer_pytorch import Reformer, ReformerLM from transformers import BertTokenizer, PreTrainedTokenizer from fairseq.optim.adafactor import Adafactor ...
reformer-pytorch-master
pretraining/self-supervised.py
from setuptools import setup, find_packages setup( name = 'tranception-pytorch', packages = find_packages(exclude=[]), version = '0.0.8', license='MIT', description = 'Tranception - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', long_description_content_type = 'text/markdown', ...
tranception-pytorch-main
setup.py
from tranception_pytorch.tranception_pytorch import Tranception
tranception-pytorch-main
tranception_pytorch/__init__.py
import math import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange from einops_exts import rearrange_many from einops.layers.torch import Rearrange # helpers def exists(val): return val is not None def default(val, d): return val if exists(val) else d # relat...
tranception-pytorch-main
tranception_pytorch/tranception_pytorch.py
from setuptools import setup, find_packages setup( name = 'g-mlp-pytorch', packages = find_packages(), version = '0.1.5', license='MIT', description = 'gMLP - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = 'https://github.com/lucidrains/g-mlp-pytorch', keywords = [ '...
g-mlp-pytorch-main
setup.py
from g_mlp_pytorch import gMLP from g_mlp_pytorch.autoregressive_wrapper import AutoregressiveWrapper import random import tqdm import gzip import numpy as np import torch import torch.optim as optim from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset # constants NUM_BATCHES = int(1...
g-mlp-pytorch-main
train.py
import torch from torch import nn import torch.nn.functional as F # helper function def eval_decorator(fn): def inner(model, *args, **kwargs): was_training = model.training model.eval() out = fn(model, *args, **kwargs) model.train(was_training) return out return inner ...
g-mlp-pytorch-main
g_mlp_pytorch/autoregressive_wrapper.py
from g_mlp_pytorch.g_mlp_pytorch import gMLP, gMLPVision, gMLPBlock, SpatialGatingUnit
g-mlp-pytorch-main
g_mlp_pytorch/__init__.py
from random import randrange import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, repeat from einops.layers.torch import Rearrange, Reduce # functions def exists(val): return val is not None def pair(val): return (val, val) if not isinstance(val, tuple) els...
g-mlp-pytorch-main
g_mlp_pytorch/g_mlp_pytorch.py
from setuptools import setup, find_packages setup( name = 'charformer-pytorch', packages = find_packages(), version = '0.0.4', license='MIT', description = 'Charformer - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = 'https://github.com/lucidrains/charformer-pytorch', ke...
charformer-pytorch-main
setup.py
from charformer_pytorch.charformer_pytorch import GBST
charformer-pytorch-main
charformer_pytorch/__init__.py
import math from math import gcd import functools import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, reduce, repeat from einops.layers.torch import Rearrange # helpers def exists(val): return val is not None def lcm(*numbers): return int(functools.reduce(...
charformer-pytorch-main
charformer_pytorch/charformer_pytorch.py
from setuptools import setup, find_packages setup( name = 'retrieval-augmented-ddpm', packages = find_packages(exclude=[]), version = '0.0.1', license='MIT', description = 'Retrieval-Augmented Denoising Diffusion Probabilistic Models', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = ...
retrieval-augmented-ddpm-main
setup.py
retrieval-augmented-ddpm-main
retrieval_augmented_ddpm/retrieval_augmented_ddpm.py
retrieval-augmented-ddpm-main
retrieval_augmented_ddpm/__init__.py
import argparse from pathlib import Path from tqdm import tqdm # torch import torch from einops import repeat # vision imports from PIL import Image from torchvision.utils import make_grid, save_image # dalle related classes and utils from dalle_pytorch import __version__ from dalle_pytorch import DiscreteVAE, O...
DALLE-pytorch-main
generate.py
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6

Models trained or fine-tuned on kye/all-lucidrain-python-3