Skip to content

NVlabs/AnyFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ AnyFlow

arXiv Project Page Gradio Demo HuggingFace

๐Ÿ“– Overview

demo_video.mp4

We introduce AnyFlow, the first any-step video diffusion framework built on flow maps. AnyFlow offers these key features:

  • โšก Any-Step Generation: Unlike traditional distilled models tied to fixed step budgets, AnyFlow enables a single model to adapt to arbitrary inference budgets. It achieves high-quality few-step generation while providing stable improvements as more sampling steps are added.
  • ๐Ÿ”€ Multiple Architectures: AnyFlow supports any-step distillation for both causal and bidirectional video diffusion models.
  • ๐ŸŽฌ Multiple Tasks: AnyFlow supports Text-to-Video, Image-to-Video, and Video-to-Video generation within one causal video diffusion model.
  • ๐Ÿ“ˆ Scalable Performance: AnyFlow is validated from 1.3B up to 14B parameters.

๐Ÿ› ๏ธ Setup Environment

1๏ธโƒฃ Create conda environment

conda create -n far python=3.10
conda activate far

2๏ธโƒฃ Install PyTorch & dependencies

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements.txt --no-build-isolation

3๏ธโƒฃ Install pre-commit (optional)

pre-commit install

๐Ÿ”ง On NVIDIA cluster

If you are on an NVIDIA internal cluster, install the logger utils:

pip install --index-url=https://sc-hw-artf.nvidia.com/artifactory/api/pypi/hwinf-mlwfo-pypi/simple --upgrade one-logger-utils

๐ŸŽฎ Run Demo

๐Ÿ“ฅ Download pretrained model

hf download nvidia/AnyFlow-FAR-Wan2.1-1.3B-Diffusers --repo-type model --local-dir experiments/pretrained_models/AnyFlow-FAR-Wan2.1-1.3B-Diffusers
hf download nvidia/AnyFlow-FAR-Wan2.1-14B-Diffusers --repo-type model --local-dir experiments/pretrained_models/AnyFlow-FAR-Wan2.1-14B-Diffusers
hf download nvidia/AnyFlow-Wan2.1-T2V-1.3B-Diffusers --repo-type model --local-dir experiments/pretrained_models/AnyFlow-Wan2.1-T2V-1.3B-Diffusers
hf download nvidia/AnyFlow-Wan2.1-T2V-14B-Diffusers --repo-type model --local-dir experiments/pretrained_models/AnyFlow-Wan2.1-T2V-14B-Diffusers

โ–ถ๏ธ Start demo

python demo.py \
    model_path=experiments/pretrained_models/AnyFlow-Wan2.1-T2V-1.3B-Diffusers \
    task_type=t2v \
    save_dir=results/demo/AnyFlow-Wan2.1-T2V-1.3B-Diffusers

๐Ÿ‹๏ธ Training

Training uses mode: train configs under options/train/anyflow/.

Data preparation

See docs/DATA.md for how to construction training dataset. We provide an exmaple dummy dataset for quick start:

hf download dc-ai/vidprom_dummy --repo-type dataset --local-dir datasets/vidprom_dummy

Launch

torchrun --nnodes 1 --nproc_per_node=8 --master_port 17154 \
    -m far.main \
    config_path=options/train/anyflow/farwan_causal/pretrain/train_farwan1b_student_shift5_81f_480p_lr5e-5_6k_b32.yml

Set --nproc_per_node to the number of GPUs you use. Logs and checkpoints go under experiments/<run_name>/ (the name field in the YAML).

๐Ÿ“Š Evaluation

Evaluation uses mode: eval configs under options/test/anyflow/.

VBench preparation

The evaluators set VBENCH_CACHE_DIR to experiments/pretrained_models/vbench. Download the VBench model bundle there:

hf download dc-ai/vbench_pretrained_models --repo-type model --local-dir experiments/pretrained_models/vbench

If you run configs that evaluate VBench I2V, download reference images for evaluation:

hf download dc-ai/vbench_i2v --repo-type dataset --local-dir datasets/vbench_i2v

Launch

torchrun --nnodes 1 --nproc_per_node=8 --master_port 17154 \
    -m far.main \
    config_path=options/test/anyflow/test_AnyFlow-FAR-Wan2.1-1.3B-Diffusers.yml

Outputs and logs are written under results/<run_name>/.

๐Ÿ“œ License

This project is released under the Apache License 2.0. See LICENSE for full text.

๐Ÿ“ฌ Contact & Discussion

Feel free to open an issue or email Yuchao Gu for questions about the codebase.

โญ Acknowledgement

This codebase is built on Diffusers. We also refer to implementations from FAR, Self-Forcing, and TiM. We thank the authors for open-sourcing their work.

๐Ÿ“š Citation

If you find AnyFlow useful in your research, please cite our work:

@article{gu2026anyflow,
    title={AnyFlow: Any-Step Video Diffusion Model with On-Policy Flow Map Distillation},
    author={Gu, Yuchao and Fang, Guian and Jiang, Yuxin and Mao, Weijia and Han, Song and Cai, Han and Shou, Mike Zheng},
    journal={arXiv preprint arXiv:2605.13724},
    year={2026}
}

@article{gu2025long,
    title={Long-Context Autoregressive Video Modeling with Next-Frame Prediction},
    author={Gu, Yuchao and Mao, weijia and Shou, Mike Zheng},
    journal={arXiv preprint arXiv:2503.19325},
    year={2025}
}

About

Flow Map OPD for AnyStep Video Diffusion

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors