Text-to-Image
Transformers
Safetensors
multi_modality
Franklin0 commited on
Commit
edd9c04
·
verified ·
1 Parent(s): 0c1fe81

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +157 -171
README.md CHANGED
@@ -1,199 +1,185 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
4
  ---
5
 
6
  # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
 
9
 
 
10
 
 
11
 
12
- ## Model Details
13
 
14
- ### Model Description
15
 
16
- <!-- Provide a longer summary of what this model is. -->
 
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
 
 
 
 
 
 
29
 
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
- ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
- ### Direct Use
 
 
 
 
 
 
 
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
 
 
 
45
 
46
- ### Downstream Use [optional]
 
 
 
 
 
 
 
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
 
49
 
50
- [More Information Needed]
 
 
 
51
 
52
- ### Out-of-Scope Use
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ license: apache-2.0
4
+ datasets:
5
+ - Franklin0/ReasonGen-R1-RL-Geneval-12k
6
+ - Franklin0/ReasonGen-R1-RL-DPG-5k
7
+ - Franklin0/ReasonGen-R1-RL-T2I-11k
8
+ base_model:
9
+ - deepseek-ai/Janus-Pro-7B
10
  ---
11
 
12
  # Model Card for Model ID
13
 
14
+ An autoregressive image generation with text-based chain-of-thought.
15
+ Official checkpoint for the paper "[ReasonGen-R1: Cot for Autoregressive Image generation models through SFT and RL](xxx)".
16
 
17
+ Website: https://aka.ms/reasongen
18
 
19
+ Code: https://github.com/Franklin-Zhang0/Image-RL
20
 
 
21
 
 
22
 
23
+ <div align="center">
24
+ <h1>🚀 ReasonGen-R1: Cot for Autoregressive Image generation models through SFT and RL</h1>
25
 
26
+ </div>
27
 
28
+ <div align="center">
 
 
 
 
 
 
29
 
30
+ <a href="https://www.deepseek.com/" target="_blank">
31
+ <img alt="Homepage" src="https://img.shields.io/badge/HomePage-blue" />
32
+ </a>
33
+ </a>
34
+ <a href="https://huggingface.co/collections/Franklin0/reasongen-r1-6836ed61fc4f6db543c0d368" target="_blank">
35
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-ReasonGen%20R1-ffc107?color=ffc107&logoColor=white" />
36
+ </a>
37
 
38
+ </div>
39
 
 
 
 
40
 
 
41
 
 
42
 
43
+ <p align="center">
44
+ <a href="#2-model-download"><b>📥 Model Download</b></a> |
45
+ <a href="#3-quick-start"><b>⚡ Quick Start</b></a> |
46
+ <a href="#4-license"><b>📜 License</b></a> |
47
+ <a href="#5-citation"><b>📖 Citation</b></a> <br>
48
+ 📄 <a href="xxxxxx"><b>Paper Link</b></a>
49
+ <!-- 🤗 Online Demo (<a href="https://huggingface.co/spaces/deepseek-ai/Janus-Pro-7B"><b>Janus-Pro-7B</b></a>, <a href="https://huggingface.co/spaces/deepseek-ai/Janus-1.3B"><b>Janus</b></a>, <a href="https://huggingface.co/spaces/deepseek-ai/JanusFlow-1.3B"><b>JanusFlow</b></a>) -->
50
+ </p>
51
 
52
+ ## 1. Introduction
53
 
54
+ Although chain-of-thought (CoT) reasoning and reinforcement learning (RL) have driven breakthroughs in NLP, their integration into generative vision models remains underexplored. We introduce ReasonGen-R1, a two-stage framework that first imbues an autoregressive image generator with explicit text-based “thinking” skills via supervised fine-tuning (SFT) on a newly generated reasoning dataset of written rationales, and then refines its outputs using Generation-Reward Proximal Optimization (GRPO).
55
+ Text-based CoT reasoning dataset for image synthesis. We automatically generate and release a corpus of step-by-step, model-crafted rationales paired with visual prompts, enabling controlled planning of object layouts, styles, and scene compositions.
56
+ RL refinement with GRPO. Our GRPO algorithm uses reward signals from a pretrained vision–language model to assess overall visual quality, optimizing the policy in each update.
57
+ Evaluations on Geneval, DPG, and the T2I benchmark demonstrate that ReasonGen-R1 consistently outperforms strong baselines and prior state-of-the-art models. We will open-source our generated reasoning dataset and training code to accelerate further advances in text-based reasoning–driven image generation.
58
 
59
+ <div align="center">
60
+ <img alt="image" src="images/model_structure_white_bg.png" style="width:90%;">
61
+ <br>
62
+ <img alt="image" src="images/benchmark_and_comparison_white_bg.png" style="width:90%; margin-top: 10px;">
63
+ </div>
64
+
65
+
66
+ ## 2. Model Download
67
 
68
+ We release ReasonGen-R1 to the public to support a broader and more diverse range of research within both academic and commercial communities.
69
+ Please note that the use of this model is subject to the terms outlined in [License section](#5-license). Commercial usage is
70
+ permitted under these terms.
71
+
72
+ ### Huggingface
73
 
74
+ | Model | Download |
75
+ |-----------------------|-----------------------------------------------------------------------------|
76
+ | ReasonGen-R1 | [🤗 Hugging Face](https://huggingface.co/Franklin0/ReasonGen-R1) |
77
+ | ReasonGen-R1-SFT-Only | [🤗 Hugging Face](https://huggingface.co/Franklin0/ReasonGen-R1-SFT) |
78
 
 
79
 
 
80
 
81
+ ## 3. Quick Start
82
 
83
+ ### Installation
84
+
85
+ You can install the necessary dependencies by running the following command:
86
+
87
+ ```shell
88
+ cd ~
89
+ mkdir project
90
+ cd project
91
+ conda create -n image_rl python==3.12 -y
92
+ conda activate image_rl
93
+ pip3 install torch==2.6.0 torchvision --index-url https://download.pytorch.org/whl/cu124
94
+ pip3 install flash-attn --no-build-isolation
95
+ git clone https://github.com/Franklin-Zhang0/Image-RL.git
96
+ cd Image-RL
97
+ pip install -r requirements.txt
98
+ pip install -e .
99
+ pip install -e ./Janus
100
+ ```
101
+
102
+ <details>
103
+ <summary><h3>Evaluation Environment Installation (Optional)</h3></summary>
104
+ If you want to run the evaluation code, you can install the evaluation environment by running the following commands:
105
+
106
+ ```shell
107
+ # Geneval
108
+ cd ~
109
+ mkdir project
110
+ cd project
111
+ git clone https://github.com/djghosh13/geneval.git
112
+ cd geneval
113
+ conda deactivate
114
+ conda create -n geneval python=3.9 -y
115
+ conda activate geneval
116
+ pip install torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1
117
+ pip install mmcv-full==1.7.0 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html
118
+ pip install mmengine==0.7.3
119
+
120
+ pip install pandas
121
+ pip install numpy==1.23.1
122
+
123
+ pip install open-clip-torch
124
+ pip install clip-benchmark
125
+
126
+ git clone https://github.com/open-mmlab/mmdetection.git
127
+ cd mmdetection; git checkout 2.x
128
+ pip install -v -e .
129
+
130
+ cd ../
131
+ bash ./evaluation/download_models.sh "./models"
132
+ ```
133
+
134
+ ```shell
135
+ # DPG
136
+ cd ~
137
+ cd project
138
+ git clone https://github.com/TencentQQGYLab/ELLA.git
139
+ cd ELLA
140
+ cp ~/project/ReasonGen-R1/requirements-for-dpg_bench.txt .
141
+ conda deactivate
142
+ conda create -n dpg_test python=3.9 -y
143
+ conda activate dpg_test
144
+ conda install conda-forge::fairseq -y
145
+ pip install -r requirements-for-dpg_bench.txt
146
+ ```
147
+
148
+ Once the eval environment is setup, you can use the following commands to run the evaluation:
149
+ ```shell
150
+ bash -i benchmark/geneval.sh
151
+ bash -i benchmark/dpg_eval.sh
152
+ ```
153
+ </details>
154
+
155
+ ### Inference
156
+ To inference with the ReasonGen-R1 model, you can use the following command:
157
+ ```shell
158
+ python Image-RL/Janus/cot_generate_inference.py
159
+ ```
160
+
161
+ ### SFT Training
162
+ To train the SFT model from Janus-Pro-7B model on the ReasonGen-R1-SFT-200k dataset, you can use the following command:
163
+ ```shell
164
+ bash Image-RL/examples/janus_sft.sh
165
+ ```
166
+
167
+ ### RL Training
168
+ To train the RL model from the ReasonGen-R1-SFT model, you can use the following command:
169
+ ```shell
170
+ bash Image-RL/Janus/janus_rl.py
171
+ ```
172
+
173
+
174
+ ## 5. Acknowledgements
175
+ We would like to thank <a href="https://github.com/volcengine/verl">Verl</a>, upon which our repo is built.
176
+
177
+ ## 4. Citation
178
+
179
+ ```bibtex
180
+ @article{yu2025reasongen,
181
+ title={ReasonGen-R1: Cot for Autoregressive Image generation models through SFT and RL},
182
+ author={Yu Zhang, Yunqi Li, Yifan Yang, Rui Wang, Yuqin Yang, Qi Dai, Jianming Bao, Dongdong Chen, Chong Luo, Lili Qiu},
183
+ year={2025}
184
+ }
185
+ ```