Autoregressive Diffusion - Pytorch
Project description
Autoregressive Diffusion - Pytorch
Implementation of the architecture behind Autoregressive Image Generation without Vector Quantization in Pytorch
oxford flowers at 59k steps
Install
$ pip install autoregressive-diffusion-pytorch
Usage
import torch
from autoregressive_diffusion_pytorch import AutoregressiveDiffusion
model = AutoregressiveDiffusion(
dim = 1024,
max_seq_len = 32,
depth = 8,
mlp_depth = 3,
mlp_width = 1024
)
seq = torch.randn(3, 32, 512)
loss = model(seq)
loss.backward()
sampled = model.sample(batch_size = 3)
assert sampled.shape == seq.shape
For images treated as a sequence of tokens (as in paper)
import torch
from autoregressive_diffusion_pytorch import ImageAutoregressiveDiffusion
model = ImageAutoregressiveDiffusion(
model = dict(
dim = 1024,
depth = 12,
heads = 12,
),
image_size = 64,
patch_size = 8
)
images = torch.randn(3, 3, 64, 64)
loss = model(images)
loss.backward()
sampled = model.sample(batch_size = 3)
assert sampled.shape == images.shape
Citations
@article{Li2024AutoregressiveIG,
title = {Autoregressive Image Generation without Vector Quantization},
author = {Tianhong Li and Yonglong Tian and He Li and Mingyang Deng and Kaiming He},
journal = {ArXiv},
year = {2024},
volume = {abs/2406.11838},
url = {https://api.semanticscholar.org/CorpusID:270560593}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for autoregressive_diffusion_pytorch-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e29ae0a80ab946cb10e475e3c936a35eb3e3dbfbe3090262fad5d5c9fa4ef04 |
|
MD5 | 2e1627cc937fa567165e0e774efefbec |
|
BLAKE2b-256 | 1fbcddaabf1454f0663a70a19c98de0c24cfdbc6632d53718ace245a15ec5344 |
Close
Hashes for autoregressive_diffusion_pytorch-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c958cbad138f5892c188513b3041eb2941fc9e2118d827e02e20f61c15cac7a8 |
|
MD5 | 0733dbdeeaf8ab0a9711659470a4e62f |
|
BLAKE2b-256 | 5006e1e2a7ca576bbe042d649265464455a5f3b5ef63fd8e38e53429089863a8 |