huggingface/finetrainers

Scalable and memory-optimized training of diffusion models

What it solves

Finetrainers 提供了一种可及的方式来训练和微调扩散模型,特别针对文本到视频和文本到图像的生成。它简化了将大型生成模型适配特定风格或任务的过程,同时管理通常与视频模型训练相关的高内存需求。

How it works

该库实现了各种训练算法和优化以提升训练效率。它支持 LoRA(低秩适配)和全秩微调,以及条件控制训练。为降低 VRAM 使用,它采用内存高效的单 GPU 训练、伪 FP8 权重转换以及多种注意力后端(如 flash、flex、sage 和 xformers)。它还处理复杂的数据管道,包括自动检测数据集格式、多分辨率分桶,以及对大规模数据集的条件和潜在向量的预计算。

Who it’s for

它面向使用扩散模型的开发者和研究者,提供一个标准化、内存高效的框架来微调如 LTX-Video、HunyuanVideo、CogVideoX、Wan、CogView4 和 Flux 等模型。

Highlights

  • Broad Model Support: Compatible with leading video and image diffusion models including LTX-Video, HunyuanVideo, and CogVideoX.
  • Memory Optimizations: Supports FP8 training and gradient checkpointing to enable training on consumer-grade hardware (e.g., LTX-Video LoRA training starting at 5 GB VRAM).
  • Distributed Training: Integrated support for DDP, FSDP-2, HSDP, and CP.
  • Flexible Data Handling: Supports combined image/video datasets and chainable local or remote datasets.