python_code
stringlengths
0
1.02M
repo_name
stringlengths
9
48
file_path
stringlengths
5
114
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_lockfile/linklockfile.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_lockfile/mkdirlockfile.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_lockfile/pidlockfile.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/chain.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/full.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/loss.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/elemwise.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/trainable.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/std/softmax.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_ext/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_ext/deepity_smat.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_io_/pydot.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_io_/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_io_/write_svg.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/deepity/deepity/_io_/load.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/demo_nnet.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/demo_minimize.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/run_tests.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/demo_convnet.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/util.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/smat.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/smat_dll.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/tests/unittest.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/tests/perftest.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/tests/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/smat/py/smat/tests/testutil.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/simplify.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/gradmap.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/util.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/globals.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/predict.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/model.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/train.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/statistics.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/data.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/basic/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/basic/model.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/basic/report.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/basic/data.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/_ext/dropoutord.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/_ext/__init__.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/_ext/corr1ord.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/_ext/poolrgn.py
# Copyright (c) 2015, Andrew Delong and Babak Alipanahi All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of...
DeepBind-master
code/libs/kangaroo/kangaroo/_ext/kangaroo_smat.py
from setuptools import setup, find_packages setup( name = 'timesformer-pytorch', packages = find_packages(), version = '0.4.1', license='MIT', description = 'TimeSformer - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = 'https://github.com/lucidrains/TimeSformer-pytorch', ...
TimeSformer-pytorch-main
setup.py
from timesformer_pytorch.timesformer_pytorch import TimeSformer
TimeSformer-pytorch-main
timesformer_pytorch/__init__.py
from math import log, pi import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat def rotate_every_two(x): x = rearrange(x, '... (d j) -> ... d j', j = 2) x1, x2 = x.unbind(dim = -1) x = torch.stack((-x2, x1), dim = -1) return rearrange(x, '... d j ...
TimeSformer-pytorch-main
timesformer_pytorch/rotary.py
import torch from torch import nn, einsum import torch.nn.functional as F from einops import rearrange, repeat from timesformer_pytorch.rotary import apply_rot_emb, AxialRotaryEmbedding, RotaryEmbedding # helpers def exists(val): return val is not None # classes class PreNorm(nn.Module): def __init__(self,...
TimeSformer-pytorch-main
timesformer_pytorch/timesformer_pytorch.py
from setuptools import setup, find_packages setup( name = 'RQ-transformer', packages = find_packages(exclude=[]), version = '0.1.9', license='MIT', description = 'RQ Transformer - Autoregressive Transformer for Residual Quantized Codes', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url ...
RQ-Transformer-main
setup.py
from rq_transformer import HierarchicalCausalTransformer 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(1e5) BATCH_SIZE = 4 GRADIENT_ACCUMULATE_EVERY ...
RQ-Transformer-main
train.py
import torch import torch.nn.functional as F from torch import nn, einsum from einops_exts import rearrange_with_anon_dims from einops import rearrange, reduce, repeat # helpers def exists(val): return val is not None def default(val, d): return val if exists(val) else d def remainder_to_mult(num, mult): ...
RQ-Transformer-main
rq_transformer/rq_transformer.py
from rq_transformer.rq_transformer import RQTransformer from rq_transformer.hierarchical_causal_transformer import HierarchicalCausalTransformer
RQ-Transformer-main
rq_transformer/__init__.py
import math import functools import torch import torch.nn.functional as F from torch import nn, einsum from einops_exts import rearrange_with_anon_dims from einops import rearrange, reduce, repeat # helpers def exists(val): return val is not None def default(val, d): return val if exists(val) else d def re...
RQ-Transformer-main
rq_transformer/hierarchical_causal_transformer.py
from all_normalization_transformer import TransformerLM from all_normalization_transformer.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, ...
all-normalization-transformer-master
train_enwik8.py
from functools import partial import torch import random from torch import nn import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence def default(value, default): return value if value is not None else default def log(t, eps=1e-9): return torch.log(t + eps) def top_p(logits, thres = 0.9):...
all-normalization-transformer-master
all_normalization_transformer/autoregressive_wrapper.py
import torch from torch import nn import torch.nn.functional as F from einops import rearrange # helpers def cum_mean(t): device = t.device running_num = torch.arange(t.shape[-1], device=t.device) + 1 return t.cumsum(dim=-1) / running_num def normalize(t, eps=1e-8): t -= t.mean(dim=-1, keepdim=True) ...
all-normalization-transformer-master
all_normalization_transformer/all_normalization_transformer.py
from all_normalization_transformer.all_normalization_transformer import TransformerLM from all_normalization_transformer.autoregressive_wrapper import AutoregressiveWrapper
all-normalization-transformer-master
all_normalization_transformer/__init__.py
from setuptools import setup, find_packages setup( name = 'gsa-pytorch', packages = find_packages(), version = '0.2.2', license='MIT', description = 'Global Self-attention Network (GSA) - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = 'https://github.com/lucidrains/global-...
global-self-attention-network-main
setup.py
from gsa_pytorch.gsa_pytorch import GSA
global-self-attention-network-main
gsa_pytorch/__init__.py
import torch import torch.nn.functional as F from torch import nn, einsum from einops import rearrange from inspect import isfunction # helpers def default(val, d): if exists(val): return val return d() if isfunction(d) else d def exists(val): return val is not None def calc_reindexing_tensor(l,...
global-self-attention-network-main
gsa_pytorch/gsa_pytorch.py
from setuptools import setup, find_packages setup( name="protein-bert-pytorch", packages=find_packages(), version="0.1.0", license="MIT", description="ProteinBERT - Pytorch", author="Phil Wang", author_email="lucidrains@gmail.com", url="https://github.com/lucidrains/protein-bert-pytorch...
protein-bert-pytorch-main
setup.py
import math import torch import torch.nn.functional as F from torch import nn, einsum from einops.layers.torch import Rearrange, Reduce from einops import rearrange, repeat # helpers def exists(val): return val is not None def max_neg_value(t): return -torch.finfo(t.dtype).max # helper classes class Resid...
protein-bert-pytorch-main
protein_bert_pytorch/protein_bert_pytorch.py
from protein_bert_pytorch.protein_bert_pytorch import ProteinBERT, PretrainingWrapper
protein-bert-pytorch-main
protein_bert_pytorch/__init__.py
from setuptools import setup, find_packages exec(open('audiolm_pytorch/version.py').read()) setup( name = 'audiolm-pytorch', packages = find_packages(exclude=[]), version = __version__, license='MIT', description = 'AudioLM - Language Modeling Approach to Audio Generation from Google Research - Pytorch', a...
audiolm-pytorch-main
setup.py
__version__ = '1.4.1'
audiolm-pytorch-main
audiolm_pytorch/version.py
import torch import transformers from transformers import T5Tokenizer, T5EncoderModel, T5Config from beartype import beartype from beartype.typing import Union, List # less warning messages since only using encoder transformers.logging.set_verbosity_error() # helper functions def exists(val): return val is not...
audiolm-pytorch-main
audiolm_pytorch/t5.py
from pathlib import Path import torch from torch import nn, einsum from torchaudio.functional import resample from einops import rearrange, repeat, pack, unpack from audiolm_pytorch.utils import curtail_to_multiple # suppress a few warnings def noop(*args, **kwargs): pass import warnings import logging logg...
audiolm-pytorch-main
audiolm_pytorch/hubert_kmeans.py
import torch from packaging import version if version.parse(torch.__version__) >= version.parse('2.0.0'): from einops._torch_specific import allow_ops_in_compiled_graph allow_ops_in_compiled_graph() from audiolm_pytorch.audiolm_pytorch import AudioLM from audiolm_pytorch.soundstream import SoundStream, AudioL...
audiolm-pytorch-main
audiolm_pytorch/__init__.py
import functools from itertools import cycle from pathlib import Path from functools import partial, wraps from itertools import zip_longest from typing import Optional import torch from torch import nn, einsum from torch.autograd import grad as torch_grad import torch.nn.functional as F from torch.linalg import vect...
audiolm-pytorch-main
audiolm_pytorch/soundstream.py
import torch from torch import nn, einsum import torch.nn.functional as F from collections import namedtuple from functools import wraps from packaging import version from einops import rearrange # constants Config = namedtuple('Config', ['enable_flash', 'enable_math', 'enable_mem_efficient']) # helpers def exist...
audiolm-pytorch-main
audiolm_pytorch/attend.py
from torch import nn # functions def round_down_nearest_multiple(num, divisor): return num // divisor * divisor def curtail_to_multiple(t, mult, from_left = False): data_len = t.shape[-1] rounded_seq_len = round_down_nearest_multiple(data_len, mult) seq_slice = slice(None, rounded_seq_len) if not fro...
audiolm-pytorch-main
audiolm_pytorch/utils.py
from pathlib import Path import torch from torch import nn from einops import rearrange import fairseq from torchaudio.functional import resample from audiolm_pytorch.utils import curtail_to_multiple import logging logging.root.setLevel(logging.ERROR) def exists(val): return val is not None class FairseqVQWa...
audiolm-pytorch-main
audiolm_pytorch/vq_wav2vec.py
from lion_pytorch import Lion from torch.optim import AdamW, Adam def separate_weight_decayable_params(params): wd_params, no_wd_params = [], [] for param in params: param_list = no_wd_params if param.ndim < 2 else wd_params param_list.append(param) return wd_params, no_wd_params def get_o...
audiolm-pytorch-main
audiolm_pytorch/optimizer.py
import math from functools import partial, wraps from beartype.typing import Optional, Union, List from beartype import beartype import torch from torch import nn, einsum, Tensor from torch.autograd import grad as torch_grad import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence import torchaudi...
audiolm-pytorch-main
audiolm_pytorch/audiolm_pytorch.py
import re from math import sqrt import copy from random import choice from pathlib import Path from shutil import rmtree from collections import Counter from beartype.typing import Union, List, Optional, Tuple from typing_extensions import Annotated from beartype import beartype from beartype.door import is_bearable ...
audiolm-pytorch-main
audiolm_pytorch/trainer.py
from functools import reduce from einops import rearrange, pack, unpack import torch from torch import nn from torchaudio.functional import resample from vector_quantize_pytorch import ResidualVQ from encodec import EncodecModel from encodec.utils import _linear_overlap_add # helper functions def exists(val): ...
audiolm-pytorch-main
audiolm_pytorch/encodec.py
from pathlib import Path from functools import partial, wraps from beartype import beartype from beartype.typing import Tuple, Union, Optional from beartype.door import is_bearable import torchaudio from torchaudio.functional import resample import torch import torch.nn.functional as F from torch.nn.utils.rnn import...
audiolm-pytorch-main
audiolm_pytorch/data.py
from setuptools import setup, find_packages exec(open('imagen_pytorch/version.py').read()) setup( name = 'imagen-pytorch', packages = find_packages(exclude=[]), include_package_data = True, entry_points={ 'console_scripts': [ 'imagen_pytorch = imagen_pytorch.cli:main', 'imagen = imagen_pytorch....
imagen-pytorch-main
setup.py
import math import copy import operator import functools from typing import List from tqdm.auto import tqdm from functools import partial, wraps from contextlib import contextmanager, nullcontext from collections import namedtuple from pathlib import Path import torch import torch.nn.functional as F from torch import ...
imagen-pytorch-main
imagen_pytorch/imagen_video.py
from math import sqrt from random import random from functools import partial from contextlib import contextmanager, nullcontext from typing import List, Union from collections import namedtuple from tqdm.auto import tqdm import torch import torch.nn.functional as F from torch import nn, einsum from torch.cuda.amp imp...
imagen-pytorch-main
imagen_pytorch/elucidated_imagen.py
import json from pydantic import BaseModel, validator from typing import List, Iterable, Optional, Union, Tuple, Dict, Any from enum import Enum from imagen_pytorch.imagen_pytorch import Imagen, Unet, Unet3D, NullUnet from imagen_pytorch.trainer import ImagenTrainer from imagen_pytorch.elucidated_imagen import Elucida...
imagen-pytorch-main
imagen_pytorch/configs.py
__version__ = '1.25.6'
imagen-pytorch-main
imagen_pytorch/version.py
import torch import transformers from typing import List from transformers import T5Tokenizer, T5EncoderModel, T5Config from einops import rearrange transformers.logging.set_verbosity_error() def exists(val): return val is not None def default(val, d): if exists(val): return val return d() if cal...
imagen-pytorch-main
imagen_pytorch/t5.py
import torch from packaging import version if version.parse(torch.__version__) >= version.parse('2.0.0'): from einops._torch_specific import allow_ops_in_compiled_graph allow_ops_in_compiled_graph() from imagen_pytorch.imagen_pytorch import Imagen, Unet from imagen_pytorch.imagen_pytorch import NullUnet from ...
imagen-pytorch-main
imagen_pytorch/__init__.py
import click import torch from pathlib import Path import pkgutil from imagen_pytorch import load_imagen_from_checkpoint from imagen_pytorch.version import __version__ from imagen_pytorch.data import Collator from imagen_pytorch.utils import safeget from imagen_pytorch import ImagenTrainer, ElucidatedImagenConfig, Ima...
imagen-pytorch-main
imagen_pytorch/cli.py
import torch from torch import nn from functools import reduce from pathlib import Path from imagen_pytorch.configs import ImagenConfig, ElucidatedImagenConfig from ema_pytorch import EMA def exists(val): return val is not None def safeget(dictionary, keys, default = None): return reduce(lambda d, key: d.get...
imagen-pytorch-main
imagen_pytorch/utils.py
import os import time import copy from pathlib import Path from math import ceil from contextlib import contextmanager, nullcontext from functools import partial, wraps from collections.abc import Iterable import torch from torch import nn import torch.nn.functional as F from torch.utils.data import random_split, Data...
imagen-pytorch-main
imagen_pytorch/trainer.py
import math import copy from random import random from beartype.typing import List, Union from beartype import beartype from tqdm.auto import tqdm from functools import partial, wraps from contextlib import contextmanager, nullcontext from collections import namedtuple from pathlib import Path import torch import torc...
imagen-pytorch-main
imagen_pytorch/imagen_pytorch.py
from pathlib import Path from functools import partial import torch from torch import nn from torch.utils.data import Dataset, DataLoader from torchvision import transforms as T, utils import torch.nn.functional as F from imagen_pytorch import t5 from torch.nn.utils.rnn import pad_sequence from PIL import Image from...
imagen-pytorch-main
imagen_pytorch/data.py
from imagen_pytorch.test import test_trainer
imagen-pytorch-main
imagen_pytorch/test/__init__.py
from imagen_pytorch.trainer import ImagenTrainer from imagen_pytorch.configs import ImagenConfig from imagen_pytorch.t5 import t5_encode_text from torch.utils.data import Dataset import torch def test_trainer_instantiation(): unet1 = dict( dim = 8, dim_mults = (1, 1, 1, 1), num_resnet_block...
imagen-pytorch-main
imagen_pytorch/test/test_trainer.py
from setuptools import setup, find_packages setup( name = 'h-transformer-1d', packages = find_packages(), version = '0.1.8', license='MIT', description = 'H-Transformer 1D - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', url = 'https://github.com/lucidrains/h-transformer-1d', ...
h-transformer-1d-main
setup.py
from h_transformer_1d import HTransformer1D from h_transformer_1d.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...
h-transformer-1d-main
train.py
import torch from torch import nn import torch.nn.functional as F # 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, **kwargs) model.train(was_tr...
h-transformer-1d-main
h_transformer_1d/autoregressive_wrapper.py
import torch import torch.nn as nn from operator import itemgetter from torch.autograd.function import Function from torch.utils.checkpoint import get_device_states, set_device_states # for routing arguments into the functions of the reversible layer def route_args(router, args, depth): routed_args = [(dict(), dic...
h-transformer-1d-main
h_transformer_1d/reversible.py
from h_transformer_1d.h_transformer_1d import HTransformer1D
h-transformer-1d-main
h_transformer_1d/__init__.py
from math import log2, ceil from functools import wraps import torch from torch import nn, einsum, diagonal import torch.nn.functional as F from h_transformer_1d.reversible import ReversibleSequence, SequentialSequence from rotary_embedding_torch import apply_rotary_emb, RotaryEmbedding from einops import rearrange, ...
h-transformer-1d-main
h_transformer_1d/h_transformer_1d.py