Improve model card for FACM: Add essential metadata, paper, and usage

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +112 -1
README.md CHANGED
@@ -1,3 +1,114 @@
1
  ---
2
  license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ pipeline_tag: unconditional-image-generation
4
+ library_name: diffusers
5
+ tags:
6
+ - flow-matching
7
+ - consistency-models
8
+ - latent-diffusion
9
+ - imagenet
10
+ ---
11
+
12
+ # FACM: Flow-Anchored Consistency Models
13
+
14
+ <h3 align="center">
15
+ 🔥 FACM outperforms 2×250-step Lightning-DiT on ImageNet 256 with only 2 steps
16
+ </h3>
17
+
18
+ <h3 align="center">
19
+ <span style="font-size: 1.2em; font-weight: bold;"><strong>FID=1.70 (1-step) &nbsp;&nbsp;&nbsp;&nbsp; FID=1.32 (2-step)</strong></span>
20
+ </h3>
21
+
22
+ 📄 This is the official implementation of the paper: [Flow-Anchored Consistency Models](https://huggingface.co/papers/2507.03738).
23
+
24
+ Code: [https://github.com/Peterande/FACM](https://github.com/Peterande/FACM)
25
+
26
+ <p align="center">
27
+ <img src="https://huggingface.co/Peterande/FACM/resolve/main/cache/teaser.png" width="800"/> <br />
28
+ </p>
29
+
30
+ ## Abstract
31
+ Continuous-time Consistency Models (CMs) promise efficient few-step generation but face significant challenges with training instability. We argue this instability stems from a fundamental conflict: by training a network to learn only a shortcut across a probability flow, the model loses its grasp on the instantaneous velocity field that defines the flow. Our solution is to explicitly anchor the model in the underlying flow during training. We introduce the Flow-Anchored Consistency Model (FACM), a simple but effective training strategy that uses a Flow Matching (FM) task as an anchor for the primary CM shortcut objective. This Flow-Anchoring approach requires no architectural modifications and is broadly compatible with standard model architectures. By distilling a pre-trained LightningDiT model, our method achieves a state-of-the-art FID of 1.32 with two steps (NFE=2) and 1.76 with just one step (NFE=1) on ImageNet 256x256, significantly outperforming previous methods. This provides a general and effective recipe for building high-performance, few-step generative models. Our code and pretrained models: this https URL .
32
+
33
+ ## ImageNet 256 Performance on 8 × A100 GPUs
34
+
35
+ | Model | Steps | FID | IS | Epochs-Pretrain | Epochs-Distill | Download |
36
+ |:-----:|:-----:|:---:|:--:|:---------------:|:--------------:|:--------:|
37
+ | FACM | 2-step | 1.32 | 292 | 800 | 100 | [100ep-stg2.pt](https://huggingface.co/Peterande/FACM/blob/main/100ep-stg2.pt) |
38
+ | FACM | 1-step | 1.76 | 290 | 800 | 250 | [250ep-stg2.pt](https://huggingface.co/Peterande/FACM/blob/main/250ep-stg2.pt) |
39
+ | FACM | 1-step | 1.70 | 295 | 800 | 400 | [400ep-stg2.pt](https://huggingface.co/Peterande/FACM/blob/main/400ep-stg2.pt) |
40
+
41
+ ## Quick Start
42
+
43
+ ### Prerequisites:
44
+
45
+ Download the required model weights and statistics files from [HuggingFace](https://huggingface.co/Peterande/FACM/tree/main) or [ModelScope](https://modelscope.cn/models/Peterande/FACM/files) to `./cache`
46
+
47
+ Including: `fid-50k-256.npz, latents_stats.pt, vavae-imagenet256-f16d32-dinov2.pt`
48
+
49
+ ### Data Preparation
50
+
51
+ ```bash
52
+ export DATA_PATH="/path/to/imagenet"
53
+ export OUTPUT_PATH="/path/to/latents"
54
+ bash scripts/extract.sh
55
+ ```
56
+
57
+ *Note: You can also download pre-extracted ImageNet latents following [Lightning-DiT](https://github.com/hustvl/LightningDiT/blob/main/docs/tutorial.md).
58
+
59
+ ### Inference
60
+ Download pretrained FACM model checkpoint [100ep-stg2.pt](https://huggingface.co/Peterande/FACM/blob/main/100ep-stg2.pt) or [400ep-stg2.pt](https://huggingface.co/Peterande/FACM/blob/main/400ep-stg2.pt) to `./cache`
61
+
62
+ ```bash
63
+ bash scripts/test.sh --ckpt-path cache/100ep-stg2.pt --sampling-steps 2
64
+ ```
65
+ ```bash
66
+ bash scripts/test.sh --ckpt-path cache/400ep-stg2.pt --sampling-steps 1
67
+ ```
68
+
69
+ ### Training
70
+ Download pretrained FM model checkpoint [800ep-stg1.pt](https://huggingface.co/Peterande/FACM/blob/main/800ep-stg1.pt) to `./cache`
71
+
72
+ ```bash
73
+ export DATA_PATH="/path/to/latents"
74
+ bash scripts/train.sh
75
+ ```
76
+
77
+ ### Pretraining (Optional)
78
+ Replace [configs/lightningdit_xl_vavae_f16d32.yaml](https://github.com/hustvl/LightningDiT/blob/main/configs/lightningdit_xl_vavae_f16d32.yaml) and [transport/transport.py](https://github.com/hustvl/LightningDiT/blob/main/transport/transport.py) of [Lightning-DiT](https://github.com/hustvl/LightningDiT) with our `ldit/lightningdit_xl_vavae_f16d32.yaml` and `ldit/transport.py`, then follow the [instructions](https://github.com/hustvl/LightningDiT/blob/main/docs/tutorial.md).
79
+
80
+ ## Reproductions
81
+ <details open>
82
+ <summary> reproductions </summary>
83
+
84
+ We include reproductions of [MeanFlow](https://arxiv.org/abs/2505.13447) and [sCM](https://arxiv.org/abs/2410.11081). Switch methods by changing the loss function in `train.py` line 81:
85
+
86
+ ```python
87
+ facm_loss = FACMLoss() # FACM (default)
88
+ facm_loss = MeanFlowLoss() # MeanFlow
89
+ facm_loss = sCMLoss() # sCM
90
+ ```
91
+ </details>
92
+
93
+ ## Citation
94
+ If you use `FACM` or its methods in your work, please cite the following BibTeX entries:
95
+ <details open>
96
+ <summary> bibtex </summary>
97
+
98
+ ```latex
99
+ @misc{peng2025facm,
100
+ title={Flow-Anchored Consistency Models},
101
+ author={Yansong Peng and Kai Zhu and Yu Liu and Pingyu Wu and Hebei Li and Xiaoyan Sun and Feng Wu},
102
+ year={2025},
103
+ eprint={2507.03738},
104
+ archivePrefix={arXiv},
105
+ primaryClass={cs.CV}
106
+ }
107
+ ```
108
+ </details>
109
+
110
+ ## Acknowledgements
111
+
112
+ The model architecture part is based on the [Lightning-DiT](https://github.com/hustvl/LightningDiT) repository.
113
+
114
+ ✨ Feel free to contribute and reach out if you have any questions! ✨