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.
conda create -n far python=3.10
conda activate farpip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -r requirements.txt --no-build-isolationpre-commit installIf 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-utilshf 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-Diffuserspython 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-DiffusersTraining uses mode: train configs under options/train/anyflow/.
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_dummytorchrun --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.ymlSet --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 uses mode: eval configs under options/test/anyflow/.
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/vbenchIf 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_i2vtorchrun --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.ymlOutputs and logs are written under results/<run_name>/.
This project is released under the Apache License 2.0. See LICENSE for full text.
Feel free to open an issue or email Yuchao Gu for questions about the codebase.
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.
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}
}