Skip to content
Back to search

FastGen

NVIDIA FastGen: Fast Generation from Diffusion Models

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked yesterday

Check it deeper on your machine

It has changed since its scan on 13 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/NVlabs/FastGen with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/NVlabs/FastGen'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/nvlabs--fastgen/badge.svg)](/listings/nvlabs--fastgen)

HTML

<a href="/listings/nvlabs--fastgen"><img src="/api/listings/nvlabs--fastgen/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

**Recommended:** Use the provided Docker container for a consistent environment. See [CONTRIBUTING.md](CONTRIBUTING.md) for Docker setup instructions. Otherwise, create a new [conda](https://www.anaconda.com/docs/getting-started/miniconda/install) environment with `conda create -y -n fastgen python=3.12.3 pip; conda activate fastgen`.

Installation

git clone https://github.com/NVlabs/FastGen.git
cd FastGen
pip install -e .

On ARM64, PyPI only provides CPU builds of PyTorch, so install the CUDA build first:

pip install "torch>=2.10,<2.11" "torchvision>=0.25,<0.26" --index-url https://download.pytorch.org/whl/cu130
pip install -e .

Credentials (Optional)

For W&B logging, [get your API key](https://wandb.ai/settings) and save it to `credentials/wandb_api.txt` or set the `WANDB_API_KEY` environment variable. Without either of these, W&B will prompt for your API key interactively. For more details, including S3 storage and other environment variables, see [fastgen/configs/README.md](fastgen/configs/README.md#environment-variables).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 243 lines
  1. <h1 align="center">NVIDIA FastGen: Fast Generation from Diffusion Models</h1>
  2. [![Documentation](https://img.shields.io/badge/Documentation-docs.nvidia.com%2Ffastgen-blue)](https://docs.nvidia.com/fastgen)
  3. [![Agent Skills](https://img.shields.io/badge/Agent%20Skills-skills%2F-blue)](skills/)
  4. [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
  5. [![PyTorch](https://img.shields.io/badge/PyTorch-2.10-ee4c2c?logo=pytorch&logoColor=white)](https://pytorch.org/)
  6. [![NVIDIA](https://img.shields.io/badge/NVIDIA-76B900?logo=nvidia&logoColor=white)](https://www.nvidia.com/)
  7. > **Note:** The current codebase offers early access to new, experimental features. Results reported in the README files were obtained using [FastGen v0.1.0](https://github.com/NVlabs/FastGen/releases/tag/v0.1.0).
  8. <p align="center">
  9. <a href="https://jberner.info/">Julius Berner</a> • <a href="https://research.nvidia.com/labs/genair/author/chao-liu/">Chao Liu</a> • <a href="http://latentspace.cc/">Arash Vahdat</a>
  10. </p>
  11. <p align="center">
  12. <a href="https://youtu.be/xEKcP-SwBBY" target="_blank">
  13. <img src="assets/teaser.png" alt="Watch the video" width=100%/>
  14. <br/>
  15. <b>Click here for a demo video</b>
  16. </a>
  17. </p>
  18. FastGen is a PyTorch-based framework for building fast generative models using various distillation and acceleration techniques. It supports:
  19. - large-scale training with ≥20B parameters.
  20. - different tasks and modalities, including T2I, I2I, I2V, V2V, multimodal video+audio generation, and causal generation.
  21. - various distillation methods, including flow maps, distribution matching, parallel decoding distillation, self-forcing, and more.
  22. ## Repository Structure
  23. ```
  24. fastgen/
  25. ├── fastgen/
  26. │ ├── callbacks/ # Training callbacks (EMA, profiling, etc.)
  27. │ ├── configs/ # Configuration system
  28. │ │ ├── experiments/ # Experiment configs
  29. │ │ └── methods/ # Method-specific configs
  30. │ ├── datasets/ # Dataset loaders
  31. │ ├── methods/ # Trajectory matching, distribution matching, and fine-tuning
  32. │ ├── networks/ # Neural network architectures
  33. │ ├── third_party/ # Third-party dependencies
  34. │ ├── trainer.py # Main training loop
  35. │ └── utils/ # Utilities (distributed, checkpointing)
  36. ├── comfyui/ # ComfyUI custom nodes for interactive inference
  37. ├── scripts/ # Inference and evaluation scripts
  38. ├── tests/ # Unit tests
  39. ├── Makefile # Development commands (lint, format, test)
  40. └── train.py # Main training entry point
  41. ```
  42. ## Setup
  43. **Recommended:** Use the provided Docker container for a consistent environment. See [CONTRIBUTING.md](CONTRIBUTING.md) for Docker setup instructions. Otherwise, create a new [conda](https://www.anaconda.com/docs/getting-started/miniconda/install) environment with `conda create -y -n fastgen python=3.12.3 pip; conda activate fastgen`.
  44. ### Installation
  45. ```bash
  46. git clone https://github.com/NVlabs/FastGen.git
  47. cd FastGen
  48. pip install -e .
  49. ```
  50. On ARM64, PyPI only provides CPU builds of PyTorch, so install the CUDA build first:
  51. ```bash
  52. pip install "torch>=2.10,<2.11" "torchvision>=0.25,<0.26" --index-url https://download.pytorch.org/whl/cu130
  53. pip install -e .
  54. ```
  55. ### Credentials (Optional)
  56. For W&B logging, [get your API key](https://wandb.ai/settings) and save it to `credentials/wandb_api.txt` or set the `WANDB_API_KEY` environment variable.
  57. Without either of these, W&B will prompt for your API key interactively.
  58. For more details, including S3 storage and other environment variables, see [fastgen/configs/README.md](fastgen/configs/README.md#environment-variables).
  59. ## Quick Start
  60. Before running the following commands, download the CIFAR-10 dataset and pretrained EDM models:
  61. ```bash
  62. python scripts/download_data.py --dataset cifar10
  63. ```
  64. For other datasets and models, see [fastgen/networks/README.md](fastgen/networks/README.md) and [fastgen/datasets/README.md](fastgen/datasets/README.md).
  65. ### Basic Training
  66. ```bash
  67. python train.py --config=fastgen/configs/experiments/EDM/config_dmd2_fast.py
  68. ```
  69. If you run out-of-memory, try a smaller batch-size, e.g., `dataloader_train.batch_size=32`, which automatically uses gradient accumulation to match the global batch-size.
  70. **Expected Output:** See the training log for a link to the run on [wandb.ai](https://wandb.ai). Training outputs go to `$FASTGEN_OUTPUT_ROOT/{project}/{group}/{name}/`, where `name` defaults to the config file's name without `.py` (see [Run Directory](fastgen/configs/README.md#run-directory)). With default settings, outputs are organized as follows:
  71. ```
  72. FASTGEN_OUTPUT/fastgen/cifar10/config_dmd2_fast/
  73. ├── checkpoints/ # Model checkpoints in the format {iteration:07d}.pth
  74. │ ├── 0001000.pth
  75. │ └── ...
  76. ├── config.yaml # Resolved configuration for reproducibility
  77. ├── wandb_id.txt # W&B run ID for resuming
  78. └── ...
  79. ```
  80. ### DDP/FSDP2 Training
  81. For multi-GPU training, use DDP:
  82. ```bash
  83. torchrun --nproc_per_node=8 train.py \
  84. --config=fastgen/configs/experiments/EDM/config_dmd2_fast.py \
  85. - trainer.ddp=True log_config.name=test_ddp
  86. ```
  87. For large models, use FSDP2 for model sharding by replacing `trainer.ddp=True` with `trainer.fsdp=True`.
  88. ### Inference
  89. ```bash
  90. python scripts/inference/image_model_inference.py --config fastgen/configs/experiments/EDM/config_dmd2_fast.py \
  91. --classes=10 --prompt_file=scripts/inference/prompts/classes.txt --ckpt_path=FASTGEN_OUTPUT/fastgen/cifar10/config_dmd2_fast/checkpoints/0002000.pth - log_config.name=test_inference
  92. ```
  93. For other inference modes and FID evaluations, see [scripts/README.md](scripts/README.md).
  94. FastGen-distilled models can also be served with:
  95. - [FlashDreams](scripts/README.md#flashdreams-example-self-forcing-wan-21-t2v) for optimized streaming inference of Self-Forcing models.
  96. - [vLLM-Omni](https://docs.vllm.ai/projects/vllm-omni/en/latest/api/vllm_omni/diffusion/models/dmd2/) for DMD2 model inference.
  97. ### Command-Line Overrides
  98. Override any config parameter using Hydra-style syntax (note the `-` separator):
  99. ```bash
  100. python train.py --config=path/to/config.py - key=value nested.key=value
  101. ```
  102. Use `+key=value` for a key the config does not define yet; see [fastgen/configs/README.md](fastgen/configs/README.md#command-line-arguments).
  103. ## Documentation
  104. The documentation is published at [docs.nvidia.com/fastgen](https://docs.nvidia.com/fastgen). Its pages are
  105. generated from the READMEs in this repository, plus the authored
  106. [training and checkpoints](https://docs.nvidia.com/fastgen/training),
  107. [troubleshooting](https://docs.nvidia.com/fastgen/troubleshooting), and
  108. [release notes](https://docs.nvidia.com/fastgen/release-notes) pages. See
  109. [Contributing to the docs](CONTRIBUTING.md#documentation) for how to edit them. The main
  110. components and their source READMEs are:
  111. | Component | README | Description |
  112. |-----------|--------|-------------|
  113. | **[Methods](https://docs.nvidia.com/fastgen/methods)** | [fastgen/methods/README.md](fastgen/methods/README.md) | Trajectory matching, distribution matching, and fine-tuning methods |
  114. | **[Networks](https://docs.nvidia.com/fastgen/networks)** | [fastgen/networks/README.md](fastgen/networks/README.md) | Network architectures (Flux, Qwen-Image, Wan, LingBot-world, Cosmos, LTX-2, etc.) and pretrained models |
  115. | **[Configs](https://docs.nvidia.com/fastgen/configuration)** | [fastgen/configs/README.md](fastgen/configs/README.md) | Configuration system, environment variables, and creating custom configs |
  116. | **[Datasets](https://docs.nvidia.com/fastgen/datasets)** | [fastgen/datasets/README.md](fastgen/datasets/README.md) | Dataset preparation and WebDataset loaders (image, video, video+audio) |
  117. | **[Callbacks](https://docs.nvidia.com/fastgen/callbacks)** | [fastgen/callbacks/README.md](fastgen/callbacks/README.md) | Training callbacks (EMA, logging, gradient clipping, etc.) |
  118. | **[Inference](https://docs.nvidia.com/fastgen/inference)** | [scripts/README.md](scripts/README.md) | Inference modes (T2I, I2I, T2V, I2V, V2V, etc.) and FID evaluation |
  119. | **[ComfyUI](https://docs.nvidia.com/fastgen/comfyui)** | [comfyui/README.md](comfyui/README.md) | ComfyUI custom nodes for interactive teacher/student inference |
  120. | **[Skills](https://docs.nvidia.com/fastgen/skills)** | [skills/README.md](skills/README.md) | Agent Skills for coding agents: setup, configuration, data, training, inference, validation, and extending FastGen |
  121. | **[Third Party](https://docs.nvidia.com/fastgen/third-party)** | [fastgen/third_party/README.md](fastgen/third_party/README.md) | Third-party dependencies (Depth Anything V2, etc.) |
  122. ## Supported Methods
  123. | Category | Methods |
  124. |----------|---------|
  125. | **Trajectory Matching** | [CM](https://arxiv.org/abs/2303.01469), [ECT](https://arxiv.org/abs/2406.14548), [sCM](https://arxiv.org/abs/2410.11081), [TCM](https://arxiv.org/abs/2410.14895), [MeanFlow](https://arxiv.org/abs/2505.13447), [AYF](https://arxiv.org/abs/2506.14603), [KD](https://arxiv.org/abs/2101.02388), [CausalKD](https://arxiv.org/abs/2412.07772), [PDD](https://arxiv.org/abs/2607.26004) |
  126. | **Distribution Matching** | [DMD2](https://arxiv.org/abs/2405.14867), [f-Distill](https://arxiv.org/abs/2502.15681), [Phased DMD](https://arxiv.org/abs/2510.27684), [LADD](https://arxiv.org/abs/2403.12015), [AnyFlow](https://arxiv.org/abs/2605.13724), [CausVid](https://arxiv.org/abs/2412.07772), [Self-Forcing](https://arxiv.org/abs/2506.08009), [Causal-Forcing](https://arxiv.org/abs/2602.02214) |
  127. | **Fine-Tuning** | [SFT](https://arxiv.org/abs/2006.11239), [CausalSFT (diffusion/teacher forcing)](https://arxiv.org/abs/2412.07772) |
  128. See [fastgen/methods/README.md](fastgen/methods/README.md) for details.
  129. ## Supported Networks and Data
  130. FastGen is designed to be **agnostic to the network and data** and you can add your own architectures and datasets (see [fastgen/networks/README.md](fastgen/networks/README.md) and [fastgen/datasets/README.md](fastgen/datasets/README.md)). For reference, we provide the following implementations:
  131. | Data | Networks |
  132. |------|----------|
  133. | **Image** | EDM, EDM2, DiT, SiT, SD 1.5, SDXL, FLUX.1, FLUX.2, Qwen-Image |
  134. | **Video** | Wan2.1, Wan2.2, Wan Vace, LingBot-world, CogVideoX, Cosmos Predict2, Cosmos 3 |
  135. | **Video+Audio** | LTX-2, LTX-2.3, LTX-2.5, MiniMax H3 |
  136. See [fastgen/networks/README.md](fastgen/networks/README.md) for details.
  137. Not all combinations of methods and networks are currently supported. We provide typical use-cases in our predefined configs in [fastgen/configs/experiments](fastgen/configs/experiments).
  138. ## Adoption, Collaboration, and Usage
  139. FastGen is used across NVIDIA and the community to build fast generative models.
  140. ### Models Distilled Using FastGen
  141. - **[FastGen-AYF](https://huggingface.co/nvidia/FastGen-AYF)** (distilled to 4-8 steps using AYF from FastGen)
  142. - **[Qwen-Image-Flash](https://huggingface.co/nvidia/Qwen-Image-Flash)** (distilled to 4 steps using DMD2 from FastGen, [NVIDIA ModelOpt](https://github.com/NVIDIA/Model-Optimizer), and [NVIDIA AutoModel](https://github.com/NVIDIA-NeMo/Automodel))
  143. - **[Baseten FLUX.2](https://www.baseten.co/blog/faster-image-generation-timestep-distillation-flux2/)** (distilled to 8 steps using DMD2)
  144. - **[Reka Real-Time Video Generation](https://reka.ai/labs/research/real-time-video-generation)** (distilled to a real-time video generator using FastGen)
  145. - **[CorrDiff](https://developer.nvidia.com/blog/accelerating-diffusion-models-with-an-open-plug-and-play-offering/)** (distilled to 1 step using ECT)
  146. - **[cBottle Super-Resolution](https://github.com/NVlabs/cBottle/blob/main/src/cbottle/training/distill_super_resolution.py)** (distilled to 2 steps using ECT)
  147. ### Projects Using FastGen
  148. - **[Simplifying and Improving On-Policy Distillation for Few-Step Diffusion](https://zjwfufu.github.io/SMD-Page/)** (built upon FastGen)
  149. - **[Parametric Trajectory Distillation for Few-Step Video Generation](https://alan-lanfeng.github.io/PTD/)** (built upon FastGen)
  150. - **[Data-Forcing Distillation: Restoring Diversity and Fidelity in Few-Step Video Generation](https://csy2077.github.io/dfd-project-page/)** (built upon FastGen)
  151. - **[Parallel Decoding Distillation for Image and Video Generation](https://research.nvidia.com/labs/genair/pdd/)** (built upon FastGen)
  152. - **[Transition Matching Distillation for Fast Video Generation](https://research.nvidia.com/labs/genair/tmd/)** (built upon FastGen)
  153. - **[Mode Seeking meets Mean Seeking for Fast Long Video Generation](https://primecai.github.io/mmm/)** (built upon FastGen)
  154. - **[StreamingEffect: Real-Time Human-Centric Video Effect Generation](https://github.com/showlab/StreamingEffect)** (built upon FastGen)
  155. - **[CARV: Variance Reduction for Expectations with Diffusion Teachers](https://research.nvidia.com/labs/sil/projects/CARV/)** (used FastGen for the DMD2 experiments)
  156. - **[Flex-Forcing: Towards a Unified Autoregressive and Bidirectional Video Diffusion Model](https://research.nvidia.com/labs/genair/flex-forcing/)** (built upon FastGen)
  157. ### FastGen Collaborations
  158. - **[FastH3 Omni](https://haoailab.com/blogs/fastvideo-omniref-update/)** (Minimax H3 Ref2VA distillation with [FastVideo](https://github.com/hao-ai-lab/FastVideo) and Nuva Lab)
  159. - **[FastH3 Preview](https://haoailab.com/blogs/fasth3-preview/)** (MiniMax H3 distillation with [FastVideo](https://github.com/hao-ai-lab/FastVideo) and Nuva Lab)
  160. - **[FlashDreams](https://github.com/NVIDIA/flashdreams)** (optimized serving for FastGen-distilled autoregressive video models)
  161. - **[NVIDIA Model Optimizer (ModelOpt)](https://github.com/NVIDIA/Model-Optimizer)** (integration of FastGen step-distillation methods)
  162. ## Contributing
  163. We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
  164. We thank everyone who has helped design, build, and test FastGen!
  165. - **Core contributors:** Julius Berner, Chao Liu
  166. - **Other contributors:** Weili Nie, Amirmojtaba Sabour, James Lucas, David Pankratz, Sushil Koundinyan, Sihyun Yu, Willis Ma, Yilun Xu, Shengqu Cai, Xinyin Ma, Yanke Song
  167. - **Collaborators:** Sophia Zalewski, Wei Xiong, Christian Laforte, Sajad Norouzi, Kaiwen Zheng, Miloš Hašan, Saeed Hadadan, Gene Liu, David Dynerman, Alicia Sui, Grace Lam, Pooya Jannaty, Jan Kautz, and many more.
  168. - **Project lead:** Arash Vahdat
  169. ## License
  170. This project is licensed under the Apache License 2.0 - see [LICENSE](LICENSE) for details. Third-party licenses are documented in [licenses/README.md](licenses/README.md).
  171. ## Reference
  172. ```
  173. @misc{fastgen2026,
  174. title={NVIDIA FastGen: Fast Generation from Diffusion Models},
  175. author={Berner, Julius and Liu, Chao and Vahdat, Arash},
  176. url={https://github.com/NVlabs/FastGen},
  177. year={2026},
  178. }
  179. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.