hanjian commited on
Commit
69fe9bd
Β·
verified Β·
1 Parent(s): a5a16d3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +180 -0
README.md ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+ # GRN: Generative Refinement Networks
5
+
6
+ [![arXiv](https://img.shields.io/badge/arXiv%20paper-2604.13030-b31b1b.svg)](https://arxiv.org/abs/2604.13030)
7
+ [![Hugging Face Space](https://img.shields.io/badge/πŸ€—%20Hugging%20Face-Space-yellow.svg)](https://huggingface.co/spaces/hanjian/GRN)
8
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![GitHub stars](https://img.shields.io/github/stars/MGenAI/GRN?style=social)](https://github.com/MGenAI/GRN)
10
+
11
+ This is the official implementation of the paper **Generative Refinement Networks for Visual Synthesis**. Neither diffusion nor autoregressive β€” GRN is a third way. 🧠 Refines globally like an artist. ⚑ Generates adaptively by complexity. πŸ† New SOTA across image & video. The visual generation paradigm just got rewritten.
12
+
13
+ ---
14
+
15
+ ## πŸ“‹ Table of Contents
16
+
17
+ - [🌟 Introduction](#-introduction)
18
+ - [οΏ½ Demo](#-demo)
19
+ - [οΏ½ Open-Source Plan](#-open-source-plan)
20
+ - [πŸ› οΈ Installation](#️-installation)
21
+ - [πŸ–ΌοΈ Class-to-Image](#️-class-to-image)
22
+ - [Dataset](#dataset)
23
+ - [Training](#training)
24
+ - [Evaluation](#evaluation)
25
+ - [πŸ“§ Contact](#-contact)
26
+ - [πŸ€— Acknowledgements](#-acknowledgements)
27
+ - [πŸ“ Citation](#-citation)
28
+
29
+ ---
30
+
31
+ ## πŸš€ Demo
32
+
33
+ Try our interactive Text-to-Image demo on πŸ€— Hugging Face Space:
34
+
35
+ **[GRN T2I Demo](https://huggingface.co/spaces/hanjian/GRN)**
36
+
37
+ Experience the power of Generative Refinement Networks firsthand by generating images from text prompts directly in your browser!
38
+
39
+ ---
40
+
41
+ ## 🌟 Introduction
42
+
43
+ Diffusion models dominate visual generation but they allocate uniform computational effort to samples with varying levels of complexity. Autoregressive (AR) models are complexity-aware, as evidenced by their variable likelihoods, but suffer from lossy tokenization and error accumulation.
44
+
45
+ We introduce **Generative Refinement Networks (GRN)**, a new visual synthesis paradigm that addresses these issues:
46
+ - **Near-lossless tokenization** via Hierarchical Binary Quantization (HBQ)
47
+ - **Global refinement mechanism** that progressively perfects outputs like a human artist
48
+ - **Entropy-guided sampling** for complexity-aware, adaptive-step generation
49
+
50
+ GRN achieves state-of-the-art results on ImageNet reconstruction and class-conditional generation, and scales effectively to text-to-image and text-to-video tasks.
51
+
52
+ ---
53
+
54
+ <figure align="center">
55
+ <figcaption><strong><em>Generative Refinement Framework</em></strong></figcaption>
56
+ <img src="demo/framework.jpg" width="100%" alt="Framework">
57
+ </figure>
58
+
59
+ <p align="center">
60
+ Starting from a random token map, GRN randomly selects more predictions at each step and refines all input tokens. For example, compared to the second step, the third step filled six new tokens (<span style="color: rgb(220, 120, 117);">pink</span>), kept two tokens (<span style="color: rgb(88, 160, 227);">blue</span>), erased two tokens (<span style="color: rgb(240, 180, 40);">yellow</span>), and left six tokens blank (<span style="color: rgb(128, 138, 151);">gray</span>).
61
+ </p>
62
+
63
+ <figure align="center">
64
+ <figcaption><strong><em>Class-to-Image Examples</em></strong></figcaption>
65
+ <img src="demo/c2i_examples.jpg" width="100%" alt="Class-to-Image Examples">
66
+ </figure>
67
+
68
+ <figure align="center">
69
+ <figcaption><strong><em>Text-to-Image Examples</em></strong></figcaption>
70
+ <img src="demo/t2i_examples.jpg" width="100%" alt="Text-to-Image Examples">
71
+ </figure>
72
+
73
+ <figure align="center">
74
+ <figcaption><strong><em>Text-to-Video Examples</em></strong></figcaption>
75
+ <video src="https://github.com/user-attachments/assets/8ce16018-0f86-4dfc-b51b-69075e8d0f15" width="100%" controls autoplay muted loop playsinline></video>
76
+ </figure>
77
+
78
+ ---
79
+
80
+ ## Open-Source Plan
81
+
82
+ GRN adopts a minimalist and self-contained design. This implementation is in PyTorch + GPU.
83
+
84
+ | Task | Checkpoints | Inference Code | Training Code |
85
+ |------|:-----------:|:--------------:|:-------------:|
86
+ | T2V | ⬜ | ⬜ | βœ… |
87
+ | T2I | ⬜ | ⬜ | βœ… |
88
+ | C2I | ⬜ | βœ… | βœ… |
89
+
90
+ ---
91
+
92
+ ## πŸ› οΈ Installation
93
+
94
+ ### Step 1: Clone the repository
95
+ ```bash
96
+ git clone https://github.com/MGenAI/GRN
97
+ cd GRN
98
+ ```
99
+
100
+ ### Step 2: Create conda environment
101
+ A suitable [conda](https://conda.io/) environment named `GRN` can be created and activated with:
102
+ ```bash
103
+ conda env create -f environment.yaml
104
+ conda activate GRN
105
+ ```
106
+
107
+ ### Troubleshooting
108
+ If you get `undefined symbol: iJIT_NotifyEvent` when importing `torch`, simply:
109
+ ```bash
110
+ pip uninstall torch
111
+ pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cu124
112
+ ```
113
+ Check this [issue](https://github.com/conda/conda/issues/13812#issuecomment-2071445372) for more details.
114
+
115
+ ---
116
+
117
+ ## πŸ–ΌοΈ Class-to-Image
118
+
119
+ ### Dataset
120
+ Download [ImageNet](http://image-net.org/download) dataset, and place it in your `IMAGENET_PATH`.
121
+
122
+ ### Training
123
+
124
+ All training scripts are located in `scripts/c2i/`. We suggest using 8x80GB GPUs for most models.
125
+
126
+ | Model | Training Script | GPUs Required |
127
+ |-------|:-------------:|:-------------:|
128
+ | GRN_ind_B | `bash scripts/c2i/train_GRN_ind_B.sh` | 8x80GB |
129
+ | GRN_bit_B | `bash scripts/c2i/train_GRN_bit_B.sh` | 8x80GB |
130
+ | GRN_ind_L | `bash scripts/c2i/train_GRN_ind_L.sh` | 8x80GB |
131
+ | GRN_ind_H | `bash scripts/c2i/train_GRN_ind_H.sh` | 16x80GB |
132
+ | GRN_ind_G | `bash scripts/c2i/train_GRN_ind_G.sh` | 32x80GB |
133
+
134
+ ### Evaluation
135
+
136
+ PyTorch pre-trained models are available [here]().
137
+
138
+ All evaluation scripts are located in `scripts/c2i/`. We suggest using 8x80GB vRAM GPUs.
139
+
140
+ | Model | Evaluation Script |
141
+ |-------|:--------------:|
142
+ | GRN_ind_B | `bash scripts/c2i/eval_GRN_ind_B.sh` |
143
+ | GRN_bit_B | `bash scripts/c2i/eval_GRN_bit_B.sh` |
144
+ | GRN_ind_L | `bash scripts/c2i/eval_GRN_ind_L.sh` |
145
+ | GRN_ind_H | `bash scripts/c2i/eval_GRN_ind_H.sh` |
146
+ | GRN_ind_G | `bash scripts/c2i/eval_GRN_ind_G.sh` |
147
+
148
+ We use [torch-fidelity](https://github.com/LTH14/torch-fidelity) to evaluate FID and IS against a reference image folder or statistics. We use the JiT's pre-computed reference stats under `grn/utils_c2i/fid_stats`.
149
+
150
+ ---
151
+
152
+ ## πŸ“§ Contact
153
+
154
+ If you are interested in scaling GRN for image generation / image editing / video generation / video editing / unified model directions, please feel free to reach out!
155
+
156
+ **πŸ“§ Email:** [hanjian.thu123@bytedance.com](mailto:hanjian.thu123@bytedance.com)
157
+
158
+ ---
159
+
160
+ ## πŸ€— Acknowledgements
161
+
162
+ - Thanks to [JiT](https://github.com/LTH14/JiT), [Infinity](https://github.com/FoundationVision/Infinity) and [InfinityStar](https://github.com/FoundationVision/InfinityStar) for their wonderful work and codebase!
163
+
164
+ ---
165
+
166
+ ## πŸ“ Citation
167
+
168
+ If you find our work useful, please consider citing:
169
+
170
+ ```bibtex
171
+ @misc{han2026grn,
172
+ title={Generative Refinement Networks for Visual Synthesis},
173
+ author={Jian Han and Jinlai Liu and Jiahuan Wang and Bingyue Peng and Zehuan Yuan},
174
+ year={2026},
175
+ eprint={2604.13030},
176
+ archivePrefix={arXiv},
177
+ primaryClass={cs.CV},
178
+ url={https://arxiv.org/abs/2604.13030},
179
+ }
180
+ ```