ShoufaChen commited on
Commit
45b20c8
·
verified ·
1 Parent(s): 4ca66b8
Files changed (1) hide show
  1. README.md +99 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - ILSVRC/imagenet-1k
5
+ ---
6
+
7
+ <div align="center">
8
+
9
+ <h1> PixelFlow: Pixel-Space Generative Models with Flow </h1>
10
+
11
+ [![arXiv](https://img.shields.io/badge/arXiv%20paper-2504.07963-b31b1b.svg)](https://arxiv.org/abs/2504.07963)
12
+ [![GitHub](https://img.shields.io/badge/GitHub-PixelFlow-181717?logo=github)](https://github.com/ShoufaChen/PixelFlow)
13
+ [![demo](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Online_Demo-blue)](https://huggingface.co/spaces/ShoufaChen/PixelFlow)&nbsp;
14
+
15
+
16
+ ![pixelflow](https://github.com/user-attachments/assets/7e2e4db9-4b41-46ca-8d43-92f2b642a676)
17
+
18
+ </div>
19
+
20
+
21
+
22
+
23
+ > [**PixelFlow: Pixel-Space Generative Models with Flow**](https://arxiv.org/abs/2504.07963)<br>
24
+ > [Shoufa Chen](https://www.shoufachen.com), [Chongjian Ge](https://chongjiange.github.io/), [Shilong Zhang](https://jshilong.github.io/), [Peize Sun](https://peizesun.github.io/), [Ping Luo](http://luoping.me/)
25
+ > <br>The University of Hong Kong, Adobe<br>
26
+
27
+ ## Introduction
28
+ We present PixelFlow, a family of image generation models that operate directly in the raw pixel space, in contrast to the predominant latent-space models. This approach simplifies the image generation process by eliminating the need for a pre-trained Variational Autoencoder (VAE) and enabling the whole model end-to-end trainable. Through efficient cascade flow modeling, PixelFlow achieves affordable computation cost in pixel space. It achieves an FID of 1.98 on 256x256 ImageNet class-conditional image generation benchmark. The qualitative text-to-image results demonstrate that PixelFlow excels in image quality, artistry, and semantic control. We hope this new paradigm will inspire and open up new opportunities for next-generation visual generation models.
29
+
30
+
31
+ ## Model Zoo
32
+
33
+ | Model | Task | Params | FID | Checkpoint |
34
+ |:---------:|:--------------:|:------:|:----:|:----------:|
35
+ | PixelFlow | class-to-image | 677M | 1.98 | [🤗](https://huggingface.co/ShoufaChen/PixelFlow-Class2Image) |
36
+ | PixelFlow | text-to-image | 882M | N/A | [🤗](https://huggingface.co/ShoufaChen/PixelFlow-Text2Image) |
37
+
38
+
39
+ ## Setup
40
+
41
+ ### 1. Create Environment
42
+ ```bash
43
+ conda create -n pixelflow python=3.12
44
+ conda activate pixelflow
45
+ ```
46
+ ### 2. Install Dependencies:
47
+ * [PyTorch 2.6.0](https://pytorch.org/) — install it according to your system configuration (CUDA version, etc.).
48
+ * [flash-attention v2.7.4.post1](https://github.com/Dao-AILab/flash-attention/releases/tag/v2.7.4.post1): optional, required only for training.
49
+ * Other packages: `pip3 install -r requirements.txt`
50
+
51
+
52
+ ## Demo [![demo](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Online_Demo-blue)](https://huggingface.co/spaces/ShoufaChen/PixelFlow)
53
+
54
+
55
+ We provide an online [Gradio demo](https://huggingface.co/spaces/ShoufaChen/PixelFlow) for class-to-image generation.
56
+
57
+ You can also easily deploy both class-to-image and text-to-image demos locally by:
58
+
59
+ ```bash
60
+ python app.py --checkpoint /path/to/checkpoint --class_cond # for class-to-image
61
+ ```
62
+ or
63
+ ```bash
64
+ python app.py --checkpoint /path/to/checkpoint # for text-to-image
65
+ ```
66
+
67
+
68
+ ## Training
69
+
70
+ ### 1. ImageNet Preparation
71
+
72
+ - Download the ImageNet dataset from [http://www.image-net.org/](http://www.image-net.org/).
73
+ - Use the [extract_ILSVRC.sh]([extract_ILSVRC.sh](https://github.com/pytorch/examples/blob/main/imagenet/extract_ILSVRC.sh)) to extract and organize the training and validation images into labeled subfolders.
74
+
75
+ ### 2. Training Command
76
+
77
+ ```bash
78
+ torchrun --nnodes=1 --nproc_per_node=8 train.py configs/pixelflow_xl_c2i.yaml
79
+ ```
80
+
81
+ ## Evaluation (FID, Inception Score, etc.)
82
+
83
+ We provide a [sample_ddp.py](sample_ddp.py) script, adapted from [DiT](https://github.com/facebookresearch/DiT), for generating sample images and saving them both as a folder and as a .npz file. The .npz file is compatible with ADM's TensorFlow evaluation suite, allowing direct computation of FID, Inception Score, and other metrics.
84
+
85
+
86
+ ```bash
87
+ torchrun --nnodes=1 --nproc_per_node=8 sample_ddp.py --pretrained /path/to/checkpoint
88
+ ```
89
+
90
+
91
+ ## BibTeX
92
+ ```bibtex
93
+ @article{chen2025pixelflow,
94
+ title={PixelFlow: Pixel-Space Generative Models with Flow},
95
+ author={Chen, Shoufa and Ge, Chongjian and Zhang, Shilong and Sun, Peize and Luo, Ping},
96
+ journal={arXiv preprint arXiv:2504.07963},
97
+ year={2025}
98
+ }
99
+ ```