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.