follow-the-mean / README.md
multimodalart's picture
multimodalart HF Staff
Initial commit: Follow the Mean (RMG) demo on FLUX.2-klein
401b937 verified
|
Raw
History Blame Contribute Delete
1.43 kB

A newer version of the Gradio SDK is available: 6.27.0

Upgrade
metadata
title: Follow the Mean (FLUX.2)
emoji: 🪷
colorFrom: pink
colorTo: indigo
sdk: gradio
sdk_version: 6.14.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Training-free reference-guided generation with FLUX.2-klein
models:
  - black-forest-labs/FLUX.2-klein-4B
tags:
  - flux
  - flux.2
  - flow-matching
  - reference-guided
  - rmg
  - training-free

Follow the Mean — FLUX.2 reference-guided generation

Training-free Reference-Mean Guidance (RMG) applied to a frozen FLUX.2-klein-4B.

The prompt says what the image is; the reference set biases which way the flow goes. Change the reference set, and the flow changes.

How it works

For deterministic flow-matching interpolants, the velocity field points toward an endpoint mean. RMG approximates a target endpoint mean from a small reference set and adds the residual correction during sampling:

u_guided(x_t, t) = u_theta(x_t, t)
    + beta_t * (mu_ref(x_t, t) - mu_theta(x_t, t)) / (1 - t)

No FLUX.2 weights are updated; the control signal lives entirely in the reference set. This Space implements that callback on top of the Flux2KleinPipeline from diffusers.