Instructions to use Harahan/MeanFlowNFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Harahan/MeanFlowNFT with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Harahan/MeanFlowNFT") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium", dtype=torch.bfloat16, device_map="cuda")
pipe.load_lora_weights("Harahan/MeanFlowNFT")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]
Bringing Forward-Process RL to Average-Velocity Generators
Yushi Huang1,2* Β· Xiangxin Zhou1*β Β· Jun Zhang2 Β· Liefeng Bo1 Β· Tianyu Pang1,β
1Tencent Hunyuan 2The Hong Kong University of Science and Technology
* Equal contribution βCorresponding authors
MeanFlowNFT optimizes reward in induced instantaneous-velocity space while retaining the average-velocity parameterization and native any-step MeanFlow sampler. Training uses only forward-noised clean samples, without reverse-trajectory likelihood estimation.
π Overview
Optimize in instantaneous-velocity space while preserving MeanFlow sampling. |
One practical MeanFlowNFT update. |
π¦ Contents
This repository contains the three ordered adapter components required to reconstruct the final policy:
.
βββ anyflow_pretrain/
β βββ generator_ema.pt
βββ anyflow_onpolicy/
β βββ generator_ema.pt
βββ meanflownft/
βββ generator_ema.pt
The loading contract is strict:
- Merge
anyflow_pretrain/generator_ema.ptinto the base transformer. - Merge
anyflow_onpolicy/generator_ema.pton top of that result. - Keep
meanflownft/generator_ema.ptas the active final adapter. - Load the complete
delta_embedderstate from the final checkpoint.
The adapter checkpoints use LoRA rank 32, alpha 64, and attention
projections matching the released code. They also contain the trainable
flow-map delta_embedder, so they are not conventional LoRA-only files.
SHA256SUMS records the checksum of every checkpoint.
π Results
MeanFlowNFT is best on 6 of 8 image metrics among the evaluated few-step models, while 4-step Wan2.1 reaches 84.33 VBench, surpassing 50-step LongCat-Video RL. See the project page for full comparisons, scaling curves, and qualitative results.
π Usage
Use the MeanFlowNFT codebase, whose
inference loader preserves the ordered adapter composition and full
delta_embedder state.
git clone https://github.com/Harahan/MeanFlowNFT.git
cd MeanFlowNFT
pip install -r requirements.txt
pip install -e .
export HF_REPO_ID=Harahan/MeanFlowNFT
hf download "${HF_REPO_ID}" --local-dir ./checkpoints/meanflownft
hf auth login
hf download stabilityai/stable-diffusion-3.5-medium \
--local-dir ./models/stable-diffusion-3.5-medium
Run the final 4-step policy:
python inference.py configs/inference/sd35m_meanflow_nft.yaml \
--override \
pretrained_path=./models/stable-diffusion-3.5-medium \
num_stages=3 \
stage1_lora_path=./checkpoints/meanflownft/anyflow_pretrain/generator_ema.pt \
stage2_lora_path=./checkpoints/meanflownft/anyflow_onpolicy/generator_ema.pt \
stage3_lora_path=./checkpoints/meanflownft/meanflownft/generator_ema.pt \
num_steps=4 \
eval_reward=false \
--prompt "a cinematic photo of a red panda"
The first two adapters are merged in order. The final MeanFlowNFT adapter stays
active and supplies delta_embedder, matching training-time evaluation. The
released inference config generates 1024Γ1024 images with CFG-free flow-map
sampling.
Do not load only the final checkpoint and do not use a generic LoRA loader that discards non-LoRA tensors. Either mistake drops part of the trained policy.
These
.ptfiles use PyTorch serialization. Load checkpoints only from a trusted source.
π Citation
@misc{huang2026meanflownftbringingforwardprocessrl,
title = {MeanFlowNFT: Bringing Forward-Process RL to Average-Velocity Generators},
author = {Huang, Yushi and Zhou, Xiangxin and Zhang, Jun and Bo, Liefeng and Pang, Tianyu},
year={2026},
eprint={2607.15273},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2607.15273},
}
π Acknowledgements
This work builds on MeanFlow, AnyFlow, DiffusionNFT, Diffusers, Transformers, and PEFT.
βοΈ License
The repository metadata and accompanying code are released under Apache 2.0. The base model and all derivative weights remain subject to the base model's license and usage terms; review them before use or redistribution.
- Downloads last month
- -
Model tree for Harahan/MeanFlowNFT
Base model
stabilityai/stable-diffusion-3.5-medium

