RePrime / README.md
Lixiaoming's picture
Upload README.md with huggingface_hub
40b37d9 verified
|
Raw History Blame Contribute Delete
6.27 kB
---
license: apache-2.0
library_name: pytorch
tags:
- image-generation
- one-step-generation
- representation-alignment
- primnet
- reprime
---
# RePrime — Align the Pair, Not the Sample
**Representation Alignment for Faster and Better One-Step Generators**
[Project page](https://mingxiao-li.github.io/RePrime/) · [Code](https://github.com/Mingxiao-Li/RePrime) · [Paper (PDF)](https://mingxiao-li.github.io/RePrime/assets/paper.pdf)
RePrime is a representation-alignment recipe for **Priming-style one-step
generators**. A Priming model is trained on corrupted real images (which have a
clean counterpart) and on pure noise (which has none). The same REPA-style
alignment loss helps on the **paired reconstruction path** and collapses
diversity on the **generative path**. RePrime aligns the paired path with a
frozen DINOv2-L/14 teacher during priming; the projector is discarded
afterwards, so inference is unchanged.
These checkpoints are released for research on ImageNet-256 one-step generation.
## Results
ImageNet 256×256, one network evaluation, no classifier-free guidance.
| Model | Paper FID ↓ | Server FID ↓ | Paper FDr⁵ ↓ | Server FDr⁵ ↓ | Seeds |
|---|---:|---:|---:|---:|---:|
| **RePrime-L / 160** | **1.155** | 1.1549 | **6.43** | 6.4298 | 3 |
| **RePrime-B / 160, block 8** | **1.268** | 1.2684 | **9.82** | 9.8179 | 3 |
| **RePrime-B / 160** | **1.303** | 1.2966 | **10.20** | 10.2089 | 3 |
| **RePrime-J / B, refined 25k** | **1.224** | 1.2284 | **10.60** | 10.5924 | 2 |
| RePrime-J / B, native 200k | 2.47 | 2.4705 | 9.75 | 9.7465 | 1 |
| Priming-B / 160 (official) | 1.373 | 1.3733 | 11.27 | 11.2654 | 3 |
| Priming-L / 160 (official) | 1.174 | 1.1738 | 7.41 | 7.4138 | 3 |
The server FID/FDr⁵ values are the recorded evaluation means. The paper's
RePrime-B FID 1.303 averages six evaluations of the same checkpoint; the
recorded three-seed mean is 1.2966 (within the reported seed variation).
RePrime-J refined was evaluated with two seeds on the server.
## Checkpoints
### Inference-ready (post-training, 25k OT updates)
| File | Model | Paper FID / FDr⁵ | Size | SHA256 |
|---|---|---:|---:|---|
| [`posttraining/reprime_l_160_25k.pth`](posttraining/reprime_l_160_25k.pth) | RePrime-L / 160 | 1.155 / 6.43 | 6.48 GB | `2b9315c259a19920…` |
| [`posttraining/reprime_b_160_blk8_25k.pth`](posttraining/reprime_b_160_blk8_25k.pth) | RePrime-B / 160, block 8 | 1.268 / 9.82 | 1.84 GB | `f6436f0c32ea845d…` |
| [`posttraining/reprime_b_160_25k.pth`](posttraining/reprime_b_160_25k.pth) | RePrime-B / 160 | 1.303 / 10.20 | 1.84 GB | `4f18a6d7323f0d72…` |
| [`posttraining/reprime_j_b_25k.pth`](posttraining/reprime_j_b_25k.pth) | RePrime-J / B, refined | 1.224 / 10.60 | 1.84 GB | `aae617ac70dc5596…` |
Full SHA256 hashes, byte sizes, configs, and evaluation records are in
[`manifest.json`](manifest.json).
### Pretraining checkpoints (stage 1, before OT)
| File | Model | Size | Note |
|---|---|---:|---|
| [`pretraining/reprime_b_160.pth`](pretraining/reprime_b_160.pth) | RePrime-B / 160 | 1.52 GB | 160-epoch milestone of the 200-epoch RePrime-B run. The exact `exp_s1_repa160e` step-200160 file is no longer on disk; this is the same recipe and step. |
| [`pretraining/reprime_b_160_blk8.pth`](pretraining/reprime_b_160_blk8.pth) | RePrime-B / 160, block 8 | 1.52 GB | 160-epoch milestone of the 200-epoch block-8 run. |
| [`pretraining/reprime_l_160.pth`](pretraining/reprime_l_160.pth) | RePrime-L / 160 | 3.46 GB | |
| [`pretraining/reprime_j_b_160.pth`](pretraining/reprime_j_b_160.pth) | RePrime-J / B, native | 1.52 GB | 200k joint updates; native FID 2.47 / FDr⁵ 9.75 without post-training. |
The checkpoint format follows the Priming training code: it contains the online
weights, the EMA shadow, and (for stage-1 files) the optimizer state. Use
`--weights ema` for the paper numbers.
## Usage
```python
from huggingface_hub import hf_hub_download
ckpt = hf_hub_download(
repo_id="Lixiaoming/RePrime",
filename="posttraining/reprime_l_160_25k.pth",
)
print(ckpt)
```
Sample with the code release:
```bash
python scripts/sample.py \
--model priming_l_160 \
--checkpoint "$ckpt" \
--num-images 8 --class-ids 207 \
--output-dir outputs/samples/reprime_l
```
`--model` selects the architecture (`priming_b_160` for B, `priming_l_160` for
L); RePrime checkpoints use the same architecture as Priming. For a stage-1
checkpoint, add `--stage pretraining` and sample the reconstruction-only model.
Evaluate with the official protocol:
```bash
bash scripts/eval_paper.sh \
priming_l_160 "$ckpt" outputs/eval/reprime_l
```
The paper protocol is 50,000 images, 3 seeds, batch 32, 4 ranks, FP32
Inception, and the JiT reference.
## Training details
* **Architecture:** pixel-space one-step transformer, B (16 blocks, width 768)
or L (32 blocks, width 1024); 16×16 patch tokens; 1 NFE.
* **Priming:** 160 epochs at fixed corruption `s=0.8`, adaptive pixel MSE +
LPIPS + ConvNeXt perceptual terms, Muon, EMA 0.9999.
* **RePrime:** adds a tokenwise cosine loss between block-5 (B) or block-10 (L)
patch tokens of `x_s` and frozen DINOv2-L/14 tokens of `x_0`; λ=0.5, full
priming window, projector discarded after training.
* **Post-training:** the official Priming OT recipe, 25,000 AdamW updates,
16 classes × 64 samples × 128 references per step, EMA 0.999.
* **RePrime-J:** joint reconstruction + OT (OT every 2 updates) for 200k
updates, optionally refined with 25k OT updates.
## License and intended use
Code and weights are released under the Apache 2.0 license. The models were
trained on ImageNet-1k; use of the weights is subject to the
[ImageNet Terms of Access](https://image-net.org/download.php). They are
intended for research on generative modeling; do not use them to generate
misleading or harmful content.
## Citation
```bibtex
@misc{li2026reprime,
title = {Align the Pair, Not the Sample: Representation Alignment for
Faster and Better One-Step Generators},
author = {Li, Mingxiao and Huang, Xuantuo and Su, Encheng and
Wang, Aoran and Zhang, Han and Zhang, Jinouwen and
Tang, Shixiang},
year = {2026},
note = {Project page: https://mingxiao-li.github.io/RePrime/}
}
```