Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
tags:
|
| 5 |
+
- image-generation
|
| 6 |
+
- one-step-generation
|
| 7 |
+
- representation-alignment
|
| 8 |
+
- primnet
|
| 9 |
+
- reprime
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# RePrime — Align the Pair, Not the Sample
|
| 13 |
+
|
| 14 |
+
**Representation Alignment for Faster and Better One-Step Generators**
|
| 15 |
+
|
| 16 |
+
[Project page](https://mingxiao-li.github.io/RePrime/) · [Code](https://github.com/Mingxiao-Li/RePrime) · [Paper (coming soon)](https://mingxiao-li.github.io/RePrime/)
|
| 17 |
+
|
| 18 |
+
RePrime is a representation-alignment recipe for **Priming-style one-step
|
| 19 |
+
generators**. A Priming model is trained on corrupted real images (which have a
|
| 20 |
+
clean counterpart) and on pure noise (which has none). The same REPA-style
|
| 21 |
+
alignment loss helps on the **paired reconstruction path** and collapses
|
| 22 |
+
diversity on the **generative path**. RePrime aligns the paired path with a
|
| 23 |
+
frozen DINOv2-L/14 teacher during priming; the projector is discarded
|
| 24 |
+
afterwards, so inference is unchanged.
|
| 25 |
+
|
| 26 |
+
These checkpoints are released for research on ImageNet-256 one-step generation.
|
| 27 |
+
|
| 28 |
+
## Results
|
| 29 |
+
|
| 30 |
+
ImageNet 256×256, one network evaluation, no classifier-free guidance.
|
| 31 |
+
|
| 32 |
+
| Model | Paper FID ↓ | Server FID ↓ | Paper FDr⁵ ↓ | Server FDr⁵ ↓ | Seeds |
|
| 33 |
+
|---|---:|---:|---:|---:|---:|
|
| 34 |
+
| **RePrime-L / 160** | **1.155** | 1.1549 | **6.43** | 6.4298 | 3 |
|
| 35 |
+
| **RePrime-B / 160, block 8** | **1.268** | 1.2684 | **9.82** | 9.8179 | 3 |
|
| 36 |
+
| **RePrime-B / 160** | **1.303** | 1.2966 | **10.20** | 10.2089 | 3 |
|
| 37 |
+
| **RePrime-J / B, refined 25k** | **1.224** | 1.2284 | **10.60** | 10.5924 | 2 |
|
| 38 |
+
| RePrime-J / B, native 200k | 2.47 | 2.4705 | 9.75 | 9.7465 | 1 |
|
| 39 |
+
| Priming-B / 160 (official) | 1.373 | 1.3733 | 11.27 | 11.2654 | 3 |
|
| 40 |
+
| Priming-L / 160 (official) | 1.174 | 1.1738 | 7.41 | 7.4138 | 3 |
|
| 41 |
+
|
| 42 |
+
The server FID/FDr⁵ values are the recorded evaluation means. The paper's
|
| 43 |
+
RePrime-B FID 1.303 averages six evaluations of the same checkpoint; the
|
| 44 |
+
recorded three-seed mean is 1.2966 (within the reported seed variation).
|
| 45 |
+
RePrime-J refined was evaluated with two seeds on the server.
|
| 46 |
+
|
| 47 |
+
## Checkpoints
|
| 48 |
+
|
| 49 |
+
### Inference-ready (post-training, 25k OT updates)
|
| 50 |
+
|
| 51 |
+
| File | Model | Paper FID / FDr⁵ | Size | SHA256 |
|
| 52 |
+
|---|---|---:|---:|---|
|
| 53 |
+
| [`posttraining/reprime_l_160_25k.pth`](posttraining/reprime_l_160_25k.pth) | RePrime-L / 160 | 1.155 / 6.43 | 6.48 GB | `2b9315c259a19920…` |
|
| 54 |
+
| [`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…` |
|
| 55 |
+
| [`posttraining/reprime_b_160_25k.pth`](posttraining/reprime_b_160_25k.pth) | RePrime-B / 160 | 1.303 / 10.20 | 1.84 GB | `4f18a6d7323f0d72…` |
|
| 56 |
+
| [`posttraining/reprime_j_b_25k.pth`](posttraining/reprime_j_b_25k.pth) | RePrime-J / B, refined | 1.224 / 10.60 | 1.84 GB | `aae617ac70dc5596…` |
|
| 57 |
+
|
| 58 |
+
Full SHA256 hashes, byte sizes, configs, and evaluation records are in
|
| 59 |
+
[`manifest.json`](manifest.json).
|
| 60 |
+
|
| 61 |
+
### Pretraining checkpoints (stage 1, before OT)
|
| 62 |
+
|
| 63 |
+
| File | Model | Size | Note |
|
| 64 |
+
|---|---|---:|---|
|
| 65 |
+
| [`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. |
|
| 66 |
+
| [`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. |
|
| 67 |
+
| [`pretraining/reprime_l_160.pth`](pretraining/reprime_l_160.pth) | RePrime-L / 160 | 3.46 GB | |
|
| 68 |
+
| [`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. |
|
| 69 |
+
|
| 70 |
+
The checkpoint format follows the Priming training code: it contains the online
|
| 71 |
+
weights, the EMA shadow, and (for stage-1 files) the optimizer state. Use
|
| 72 |
+
`--weights ema` for the paper numbers.
|
| 73 |
+
|
| 74 |
+
## Usage
|
| 75 |
+
|
| 76 |
+
```python
|
| 77 |
+
from huggingface_hub import hf_hub_download
|
| 78 |
+
|
| 79 |
+
ckpt = hf_hub_download(
|
| 80 |
+
repo_id="Lixiaoming/RePrime",
|
| 81 |
+
filename="posttraining/reprime_l_160_25k.pth",
|
| 82 |
+
)
|
| 83 |
+
print(ckpt)
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Sample with the code release:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
python scripts/sample.py \
|
| 90 |
+
--model priming_l_160 \
|
| 91 |
+
--checkpoint "$ckpt" \
|
| 92 |
+
--num-images 8 --class-ids 207 \
|
| 93 |
+
--output-dir outputs/samples/reprime_l
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
`--model` selects the architecture (`priming_b_160` for B, `priming_l_160` for
|
| 97 |
+
L); RePrime checkpoints use the same architecture as Priming. For a stage-1
|
| 98 |
+
checkpoint, add `--stage pretraining` and sample the reconstruction-only model.
|
| 99 |
+
|
| 100 |
+
Evaluate with the official protocol:
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
bash scripts/eval_paper.sh \
|
| 104 |
+
priming_l_160 "$ckpt" outputs/eval/reprime_l
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
The paper protocol is 50,000 images, 3 seeds, batch 32, 4 ranks, FP32
|
| 108 |
+
Inception, and the JiT reference.
|
| 109 |
+
|
| 110 |
+
## Training details
|
| 111 |
+
|
| 112 |
+
* **Architecture:** pixel-space one-step transformer, B (16 blocks, width 768)
|
| 113 |
+
or L (32 blocks, width 1024); 16×16 patch tokens; 1 NFE.
|
| 114 |
+
* **Priming:** 160 epochs at fixed corruption `s=0.8`, adaptive pixel MSE +
|
| 115 |
+
LPIPS + ConvNeXt perceptual terms, Muon, EMA 0.9999.
|
| 116 |
+
* **RePrime:** adds a tokenwise cosine loss between block-5 (B) or block-10 (L)
|
| 117 |
+
patch tokens of `x_s` and frozen DINOv2-L/14 tokens of `x_0`; λ=0.5, full
|
| 118 |
+
priming window, projector discarded after training.
|
| 119 |
+
* **Post-training:** the official Priming OT recipe, 25,000 AdamW updates,
|
| 120 |
+
16 classes × 64 samples × 128 references per step, EMA 0.999.
|
| 121 |
+
* **RePrime-J:** joint reconstruction + OT (OT every 2 updates) for 200k
|
| 122 |
+
updates, optionally refined with 25k OT updates.
|
| 123 |
+
|
| 124 |
+
## License and intended use
|
| 125 |
+
|
| 126 |
+
Code and weights are released under the Apache 2.0 license. The models were
|
| 127 |
+
trained on ImageNet-1k; use of the weights is subject to the
|
| 128 |
+
[ImageNet Terms of Access](https://image-net.org/download.php). They are
|
| 129 |
+
intended for research on generative modeling; do not use them to generate
|
| 130 |
+
misleading or harmful content.
|
| 131 |
+
|
| 132 |
+
## Citation
|
| 133 |
+
|
| 134 |
+
```bibtex
|
| 135 |
+
@misc{reprime2026,
|
| 136 |
+
title = {Align the Pair, Not the Sample: Representation Alignment for
|
| 137 |
+
Faster and Better One-Step Generators},
|
| 138 |
+
author = {Anonymous Authors},
|
| 139 |
+
year = {2026},
|
| 140 |
+
note = {Project page: https://mingxiao-li.github.io/RePrime/}
|
| 141 |
+
}
|
| 142 |
+
```
|