Purpose: diffusion-pipe is a pipeline-parallel training script for diffusion models, providing unified support for training image and video models, and is suitable for training models that exceed single-GPU memory capacity in multi-GPU environments.
Main capabilities: It uses a hybrid of pipeline parallelism and data parallelism, controlling the degree of parallelism via --num_gpus and pipeline_stages in the configuration (the number of GPUs must be divisible by pipeline_stages). It supports many models such as SDXL, Flux, LTX-Video, HunyuanVideo, Cosmos, Wan2.1/2.2, Stable Diffusion 3, Qwen-Image, Z-Image, and Flux 2. It provides Tensorboard metric logging, hold-out evaluation set metric computation, checkpoint saving and resumption, multi-process multi-GPU pre-caching of latents and text embeddings, and allows adding new models by implementing a single subclass.
Usage: First clone the repository (including submodules), install Miniconda and create an environment, first install PyTorch and nvcc matching your hardware yourself, then run pip install -r requirements.txt -U to install the remaining dependencies. Some models require additionally installing Flash Attention, and Cosmos also requires TransformerEngine. The dataset is a directory containing images or videos and .txt caption files with the same names; after modifying the paths according to the configuration files in the examples directory, start train.py with deepspeed and specify --config. After enabling checkpoints, you can resume training with --resume_from_checkpoint. Cache-related parameters include --cache_only, --regenerate_cache, and --trust_cache.
Limitations: Native Windows is difficult to support because DeepSpeed only partially supports Windows; WSL 2 is recommended. Due to the caching mechanism, training LoRA for the text encoder is currently not supported. WebP videos are not supported. When resuming training, the configuration file passed via the command line is used, and you need to ensure it is consistent with the previous one yourself.