Run this model with HF Jobs

Run guyuchao/AnyFlow2-LoRA-Collections on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/guyuchao/AnyFlow2-LoRA-Collections. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/guyuchao/AnyFlow2-LoRA-Collections on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
guyuchao's picture
Initial AnyFlow 2.0 LoRA release
8abc42a
|
Raw History Blame Contribute Delete
8.57 kB
---
license: apache-2.0
language:
- en
- zh
base_model:
- black-forest-labs/FLUX.1-dev
- black-forest-labs/flux-3-image-klein-base
- Wan-AI/Wan2.1-T2V-14B-Diffusers
- MiniMaxAI/MiniMax-H3
library_name: diffusers
tags:
- anyflow2
- lora
- diffusion-distillation
- text-to-image
- text-to-video
- audio-video-generation
- reference-conditioned-generation
---
# AnyFlow 2.0 LoRA Collections
<p align="center">
🖥️ <a href="https://github.com/NVlabs/AnyFlow">Code</a> &nbsp;|&nbsp;
📑 <a href="https://arxiv.org/abs/2612.05524">Paper</a> &nbsp;|&nbsp;
🌐 <a href="https://nvlabs.github.io/AnyFlow/2.0/">Website</a> &nbsp;|&nbsp;
🎬 <a href="https://www.youtube.com/watch?v=BZtCBaqqO4s">Video</a> &nbsp;|&nbsp;
🤗 <a href="https://huggingface.co/guyuchao/AnyFlow2-LoRA-Collections">Models</a>
</p>
-----
**AnyFlow 2.0: Large-Scale Video Diffusion Distillation with Distributional Trajectory Regression**
AnyFlow 2.0 distills large diffusion models through **distributional trajectory regression (DTR)**. A continuous curvature head represents velocities inside each sampling transition, allowing trajectory regression and distribution matching to train the same intermediate student trajectory. A parameterized fake-score model supplies distribution feedback that distinguishes the source intervals.
This collection provides five BF16 EMA LoRA adapters for image, video, and audio-video generation. The supplied inference configurations use **4 sampling steps**.
![AnyFlow 2.0 performance across six tasks](https://nvlabs.github.io/AnyFlow/2.0/assets/figures/application-overview.jpg?v=e1baf54edc6c)
*Performance overview from the [AnyFlow 2.0 project page](https://nvlabs.github.io/AnyFlow/2.0/). The figure covers the paper's six tasks; this collection contains the five bidirectional adapters listed below.*
## Video Demos
<div align="center">
<video width="80%" autoplay loop muted playsinline controls>
<source src="https://nvlabs.github.io/AnyFlow/2.0/assets/showcase/demo.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
## Released Models
| Model | Task | Base model | Download |
| --- | --- | --- | --- |
| FLUX.1 Dev | Text to image | [black-forest-labs/FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) | [LoRA](FLUX.1-Dev/AnyFlow2-FLUX.1-Dev-4step.pt) · [Config](FLUX.1-Dev/inference.yml) |
| FLUX.3 Klein Base | Text to image | [black-forest-labs/flux-3-image-klein-base](https://huggingface.co/black-forest-labs/flux-3-image-klein-base) | [LoRA](FLUX.3-Klevin-Base/AnyFlow2-FLUX.3-Klevin-Base-4step.pt) · [Config](FLUX.3-Klevin-Base/inference.yml) |
| Wan2.1 T2V 14B | Text to video | [Wan-AI/Wan2.1-T2V-14B-Diffusers](https://huggingface.co/Wan-AI/Wan2.1-T2V-14B-Diffusers) | [LoRA](Wan2.1-T2V-14B/AnyFlow2-Wan2.1-T2V-14B-4step.pt) · [Config](Wan2.1-T2V-14B/inference.yml) |
| H3 T2VA 33B | Text to video and audio | [MiniMaxAI/MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) | [LoRA](H3-T2VA-33B/AnyFlow2-H3-T2VA-33B-4step.pt) · [Config](H3-T2VA-33B/inference.yml) |
| H3 Ref2VA 33B | Reference to video and audio | [MiniMaxAI/MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) | [LoRA](H3-Ref2VA-33B/AnyFlow2-H3-Ref2VA-33B-4step.pt) · [Config](H3-Ref2VA-33B/inference.yml) |
H3 generates video with a stereo audio track. FLUX.3 also uses the official [prompt upsampler](https://huggingface.co/black-forest-labs/flux-3-image-klein-pup).
The adapters use the AnyFlow 2.0 model classes and schedulers. Load them with the corresponding base model and the provided configuration in the [AnyFlow codebase](https://github.com/NVlabs/AnyFlow).
## Quickstart
### 1. Set Up the Environment
From the AnyFlow 2.0 code repository root:
```bash
conda create -n anyflow2 python=3.11 -y
conda activate anyflow2
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements.txt --no-build-isolation
```
### 2. Download the Models
Download this collection into the directory used by the demo and configs:
```bash
hf download guyuchao/AnyFlow2-LoRA-Collections --local-dir experiments/pretrained_models/AnyFlow2-LoRA-Collections
```
To download just one adapter and its config, select its folder:
```bash
hf download guyuchao/AnyFlow2-LoRA-Collections --include "Wan2.1-T2V-14B/*" --local-dir experiments/pretrained_models/AnyFlow2-LoRA-Collections
```
Download the base model for the task you want to run. FLUX.3 needs both its base model and prompt upsampler:
```bash
# FLUX.1
hf download black-forest-labs/FLUX.1-dev --local-dir experiments/pretrained_models/FLUX.1-dev
# FLUX.3
hf download black-forest-labs/flux-3-image-klein-base --local-dir experiments/pretrained_models/flux-3-image-klein-base
hf download black-forest-labs/flux-3-image-klein-pup --local-dir experiments/pretrained_models/flux-3-image-klein-pup
# Wan2.1
hf download Wan-AI/Wan2.1-T2V-14B-Diffusers --local-dir experiments/pretrained_models/Wan2.1-T2V-14B-Diffusers
# H3: shared base model for T2VA and Ref2VA
hf download MiniMaxAI/MiniMax-H3 --local-dir experiments/pretrained_models/MiniMax-H3
```
For gated repositories, sign in with `hf auth login` and obtain access from the corresponding model page.
### 3. Generate One Example
Each demo uses an example from the code repository's `assets/validation/` directory and seed **1**:
```bash
python demo.py task=flux1_t2i
python demo.py task=flux3_t2i
python demo.py task=wan_t2v
python demo.py task=h3_t2va
python demo.py task=h3_ref2va
```
The examples include a Hanfu tea illustration for FLUX, a Jeep scene for Wan and H3 T2VA, and two reference images for H3 Ref2VA. Outputs are saved under `results/demo/`. Set `save_dir=/path/to/outputs` to change the destination.
### 4. Run the Full Sample Set
Each `inference.yml` matches its corresponding config under `options/test/` in the code repository. Run it from the code repository root:
```bash
torchrun --standalone --nproc_per_node=4 -m far.main config_path=experiments/pretrained_models/AnyFlow2-LoRA-Collections/FLUX.1-Dev/inference.yml
torchrun --standalone --nproc_per_node=4 -m far.main config_path=experiments/pretrained_models/AnyFlow2-LoRA-Collections/FLUX.3-Klevin-Base/inference.yml
torchrun --standalone --nproc_per_node=4 -m far.main config_path=experiments/pretrained_models/AnyFlow2-LoRA-Collections/Wan2.1-T2V-14B/inference.yml
torchrun --standalone --nproc_per_node=4 -m far.main config_path=experiments/pretrained_models/AnyFlow2-LoRA-Collections/H3-T2VA-33B/inference.yml
torchrun --standalone --nproc_per_node=4 -m far.main config_path=experiments/pretrained_models/AnyFlow2-LoRA-Collections/H3-Ref2VA-33B/inference.yml
```
Set `--nproc_per_node` to the number of GPUs available for inference; model weights are sharded across those GPUs. The configs process the complete sample set from `assets/validation/` with seeds **0 and 1**. Ref2VA loads each sample's metadata and reference media from the same assets directory. Keep these assets when running the configs.
Generated samples and test logs are written under `results/<name>/`, where `name` comes from the YAML. Change `models.transformer_cfg.model_name` for a different local base-model location or `models.transformer_cfg.pretrained_path` for a different local adapter location. The configs load the adapter's `ema` weights with `pretrained_type: lora`.
## License
The LoRA adapter weights in this collection are released under the [Apache License 2.0](LICENSE).
The base models are distributed separately under their respective licenses. Refer to the base-model cards linked above for their terms.
## Citation
If you use AnyFlow 2.0 in your research, please cite:
```bibtex
@article{gu2026anyflow2,
title={AnyFlow 2.0: Large-Scale Video Diffusion Distillation with Distributional Trajectory Regression},
author={Gu, Yuchao and Fang, Guian and Song, Yiren and Wu, Junyi and Chen, Lan and Xin, Jingyu and Jiang, Yuxin and Zhan, Guanqi and Lu, Liming and Chen, Junyu and Ge, Wenhang and Mao, Qi and Ye, Yixuan and Lu, Dongyue and Huang, Junchao and Shou, Mike Zheng and Han, Song and Cai, Han},
journal={arXiv preprint arXiv:2612.05524},
year={2026}
}
```
## Acknowledgements
We thank the authors of [Diffusers](https://github.com/huggingface/diffusers), [PEFT](https://github.com/huggingface/peft), [FLUX](https://huggingface.co/black-forest-labs), [Wan](https://github.com/Wan-Video/Wan2.1), and [MiniMax H3](https://huggingface.co/MiniMaxAI/MiniMax-H3) for their models and tools.