Autoregressive Diffusion - Pytorch
Project description
Autoregressive Diffusion - Pytorch
Implementation of the architecture behind Autoregressive Image Generation without Vector Quantization in Pytorch
You can discuss the paper temporarily here
Install
$ pip install autoregressive-diffusion-pytorch
Usage
import torch
from autoregressive_diffusion_pytorch import AutoregressiveDiffusion
model = AutoregressiveDiffusion(
dim = 512,
max_seq_len = 32
)
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 = 512
),
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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | eca71031a1f3d6bfee76e1c1c2ebda5e76838d9499ff6a4e0e6040f2d66b0de3 |
|
MD5 | 94ca1d850835ba620a47f7c2ca70286f |
|
BLAKE2b-256 | bd05e206eb384eb85922bb5cb70c9f236e5f2cc240d9c625e430f9f1da9ecf9d |
Close
Hashes for autoregressive_diffusion_pytorch-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf12a18c185d445e39b4695bd62bc63254c5d848dc19e11668babe1b7aaa1bfa |
|
MD5 | 3fabbc7ce3a22cb01d3475771c362a0d |
|
BLAKE2b-256 | 6d31a4cc922129668c49f2aab5833f9d7e3e29bcc578f83d5fa355a4f190df83 |