[NeurIPS 2024 Best Paper Award][GPT beats diffusion🔥] [scaling laws in visual generation📈] Official impl. of "Visual Autoregressive Modeling: Scalable Image Generation via Next-Scale Prediction". An *ultra-simple, user-friendly yet state-of-the-art* codebase for autoregressive image generation!

★ 8,764⑂ 574👁 100⑃ 11● 168▤ 0
Jupyter NotebookCreated 2024-04-02
8,764
stars
+0+0+25
574
forks
100
watchers
11
prs
168
issues
0
releases
–
discussions

README

VAR: a new visual generation method elevates GPT-style models beyond diffusion🚀 & Scaling laws observed📈



 
 
 





  Visual Autoregressive Modeling: Scalable Image Generation via Next-Scale Prediction



  
    NeurIPS 2024 Best Paper
  








 News
 2025-11: We Release our Text-to-Video generation model InfinityStar based on VAR & Infinity, please check Infinity⭐️.
 2025-11: 🎉 InfinityStar is accepted as NeurIPS 2025 Oral.
 2025-04: 🎉 Infinity is accepted as CVPR 2025 Oral.
 2024-12: 🏆 VAR received NeurIPS 2024 Best Paper Award.
 2024-12: 🔥 We Release our Text-to-Image research based on VAR, please check Infinity.
 2024-09: VAR is accepted as NeurIPS 2024 Oral Presentation.
 2024-04: Visual AutoRegressive modeling is released.

 🕹️ Try and Play with VAR!

~~We provide a demo website for you to play with VAR models and generate images interactively. Enjoy the fun of visual autoregressive modeling!~~

We provide a demo website for you to play with VAR Text-to-Image and generate images interactively. Enjoy the fun of visual autoregressive modeling!

We also provide demo_sample.ipynb for you to see more technical details about VAR.

[//]:  ()
[//]:  ()


 What's New?

 🔥 Introducing VAR: a new paradigm in autoregressive visual generation✨:

Visual Autoregressive Modeling (VAR) redefines the autoregressive learning on images as coarse-to-fine "next-scale prediction" or "next-resolution prediction", diverging from the standard raster-scan "next-token prediction".





 🔥 For the first time, GPT-style autoregressive models surpass diffusion models🚀:





 🔥 Discovering power-law Scaling Laws in VAR transformers📈:










 🔥 Zero-shot generalizability🛠️:





 For a deep dive into our analyses, discussions, and evaluations, check out our paper.


 VAR zoo
We provide VAR models for you to play with, which are on  or can be downloaded from the following links:

|   model    | reso. |   FID    | rel. cost | params | HF weights🤗                                                                        |
|:----------:|:-----:|:--------:|:---------:|:-------:|:------------------------------------------------------------------------------------|
|  VAR-d16   |  256  |   3.55   |    0.4    |  310M   | var_d16.pth |
|  VAR-d20   |  256  |   2.95   |    0.5    |  600M   | var_d20.pth |
|  VAR-d24   |  256  |   2.33   |    0.6    |  1.0B   | var_d24.pth |
|  VAR-d30   |  256  |   1.97   |     1     |  2.0B   | var_d30.pth |
| VAR-d30-re |  256  | 1.80 |     1     |  2.0B   | var_d30.pth |
| VAR-d36    |  512  | 2.63 |     -     |  2.3B   | var_d36.pth |

You can load these models to generate images via the codes in demo_sample.ipynb. Note: you need to download vae_ch160v4096z32.pth first.


 Installation

1. Install torch=2.0.0.
2. Install other pip packages via pip3 install -r requirements.txt.
3. Prepare the ImageNet dataset
    
     assume the ImageNet is in /path/to/imagenet. It should be like this:

    
    /path/to/imagenet/:
        tr

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON