Upload RTDMD checkpoint and model card
Browse files- README.md +103 -0
- cold_start/generator_ema.pt +3 -0
- rtdmd/generator_ema.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
pipeline_tag: text-to-image
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-image
|
| 7 |
+
- diffusion
|
| 8 |
+
- flow-matching
|
| 9 |
+
- lora
|
| 10 |
+
- rtdmd
|
| 11 |
+
- flux
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
<div align="center">
|
| 15 |
+
|
| 16 |
+
<img width="70%" height="70%" alt="logo" src="https://github.com/user-attachments/assets/4d534e80-f8ec-4c0b-948f-730cc0311961" />
|
| 17 |
+
|
| 18 |
+
<h2> Reinforcing Few-step Generators via Reward-Tilted Distribution Matching </h2>
|
| 19 |
+
|
| 20 |
+
<p><b>Reward-Tilted DMD Β· Ambient-Consistent Distillation Β· Hybrid Policy Gradient</b></p>
|
| 21 |
+
|
| 22 |
+
[](<TODO: arxiv link>)
|
| 23 |
+
[](https://github.com/Harahan/RTDMD)
|
| 24 |
+
[](https://huggingface.co/collections/Harahan/rtdmd)
|
| 25 |
+
|
| 26 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 27 |
+
[](https://www.python.org/)
|
| 28 |
+
|
| 29 |
+
</div>
|
| 30 |
+
|
| 31 |
+
<div align="center">
|
| 32 |
+
|
| 33 |
+
[Yushi Huang](https://harahan.github.io/)<sup>1, 2,</sup>\*<sup>β </sup>, [Xiangxin Zhou](https://zhouxiangxin1998.github.io/)<sup>2,</sup>\*, Ruoyu Wang<sup>2, 3,</sup>\*<sup>β </sup>, [Chi Zhang](https://icoz69.github.io/)<sup>3</sup>, [Jun Zhang](https://eejzhang.people.ust.hk/)<sup>1</sup>, [Tianyu Pang](https://p2333.github.io/)<sup>2,</sup>β‘
|
| 34 |
+
|
| 35 |
+
<sup>1</sup>The Hong Kong University of Science and Technology
|
| 36 |
+
<sup>2</sup>Tencent Hunyuan
|
| 37 |
+
<sup>3</sup>Westlake University
|
| 38 |
+
|
| 39 |
+
\* Equal contribution Β· β Work done during internship at Tencent Hunyuan Β· β‘ Corresponding author
|
| 40 |
+
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## Abstract
|
| 46 |
+
|
| 47 |
+
We propose **Reward-Tilted Distribution Matching Distillation (RTDMD)**, a two-stage framework that unifies distribution-matching distillation with reward-guided RL for few-step flow generators. Minimizing the KL divergence to a *reward-tilted teacher distribution* decomposes naturally into a **distribution-matching** term and a **reward-maximization** term, instantiated as **Ambient-Consistent DMD (AC-DMD)** for the cold start and a **hybrid policy gradient** for the RL stage.
|
| 48 |
+
|
| 49 |
+
This repository hosts the **FLUX.2-klein 9B** RTDMD LoRA checkpoints for **4-NFE** text-to-image generation.
|
| 50 |
+
|
| 51 |
+
<div align="center">
|
| 52 |
+
<img src="https://github.com/user-attachments/assets/cb1fb0da-d388-4846-9017-66bccebd0749" alt="RTDMD teaser" width="70%">
|
| 53 |
+
<br/>
|
| 54 |
+
<em>4-step samples from RTDMD-distilled generators (no classifier-free guidance).</em>
|
| 55 |
+
</div>
|
| 56 |
+
|
| 57 |
+
<div align="center">
|
| 58 |
+
<img src="https://github.com/user-attachments/assets/61a64fca-a143-40ae-9e36-79c6fcb5b696" alt="RTDMD method overview" width="70%">
|
| 59 |
+
<br/>
|
| 60 |
+
<em>RTDMD overview. <b>Det.</b> = deterministic final step, <b>Stoc.</b> = stochastic intermediate steps.</em>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
## Contents
|
| 64 |
+
|
| 65 |
+
```text
|
| 66 |
+
.
|
| 67 |
+
βββ cold_start/
|
| 68 |
+
β βββ generator_ema.pt # Stage-1 AC-DMD LoRA
|
| 69 |
+
βββ rtdmd/
|
| 70 |
+
βββ generator_ema.pt # Stage-2 RTDMD LoRA
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Each `generator_ema.pt` is a `torch.save`-d LoRA `state_dict` containing only adapter weights. The two adapters are intended to be stacked in order: first `cold_start`, then `rtdmd`.
|
| 74 |
+
|
| 75 |
+
## Usage
|
| 76 |
+
|
| 77 |
+
The recommended path is the RTDMD inference CLI, which handles LoRA stacking and the CPS scheduler used during training.
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
git clone https://github.com/Harahan/RTDMD.git
|
| 81 |
+
cd RTDMD
|
| 82 |
+
pip install -r requirements.txt
|
| 83 |
+
pip install -e .
|
| 84 |
+
|
| 85 |
+
huggingface-cli download Harahan/FLUX2-9B-RTDMD --local-dir ./ckpts/flux2_9b
|
| 86 |
+
|
| 87 |
+
python inference.py configs/inference/flux2_9b.yaml \
|
| 88 |
+
--override lora_paths='["./ckpts/flux2_9b/cold_start/generator_ema.pt","./ckpts/flux2_9b/rtdmd/generator_ema.pt"]' \
|
| 89 |
+
--override eval_reward=false \
|
| 90 |
+
--prompt "a cute cat sitting on a windowsill"
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
RTDMD is trained for 4-step generation with CPS (`cps_eta=0.9`) and `guidance_scale=1.0`.
|
| 94 |
+
|
| 95 |
+
## Citation
|
| 96 |
+
|
| 97 |
+
```bibtex
|
| 98 |
+
<TODO: add bibtex after arXiv release>
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## License
|
| 102 |
+
|
| 103 |
+
Apache 2.0, same as the upstream [RTDMD](https://github.com/Harahan/RTDMD) repository. The base model `black-forest-labs/FLUX.2-klein-9B` is governed by its own license; please review and comply with it separately.
|
cold_start/generator_ema.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da6ee352e06684a8a472f204600a8505415a8d96c3b975c7a3e5f6dccb566098
|
| 3 |
+
size 128008714
|
rtdmd/generator_ema.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85ab08c37ad96d60476fffba7b42a9b5a05e16f205cbf30e4e59ca987d5fb39b
|
| 3 |
+
size 128003914
|