logo
0
0
Login
编辑文件 README.md

🚀 适用教程

https://www.bilibili.com/video/BV1RbGTzfEQF/?vd_source=2ebab812a46c68cabe85acf4e3468677

可以自动断点继续炼


🚀 T2ITrainer

⚠️ Development Notice: Currently in active development - stability not guaranteed. Frequent updates - check changelogs regularly.

T2ITrainer is a diffusers based training script. It aims to provide simple yet implementation for lora training.

📅 Recent Updates

  • 2025-07-16:
    add --config_path argument to train_flux_lora_ui_kontext.py support config file to start the kontext training
python train_flux_lora_ui_kontext.py --config_path config.json

🛡️ Prerequisites

  • PyTorch: torch>=2.3.0+cu121 (CUDA 12.1 supported) PyPI

💻 Supported Training Configurations

Model TypeVRAM RequirementsStatus
Kolors11GB GPU✅ Supported
SD3.5 (FP16 BS1)24GB GPU✅ Supported
Flux Fill,Kontext24GB GPU✅ Supported

⚙️ Installation Guide

0. System Requirements

Mandatory: Install Microsoft Visual C++ Redistributable if encountering DLL errors

1. Automated Setup

Recommended Method

git clone https://github.com/lrzjason/T2ITrainer.git cd T2ITrainer setup.bat
  • Handles: Virtual Environment • Dependency Installation • Model Downloads

2. Manual Installation

Clone Repository 🌐

git clone https://github.com/lrzjason/T2ITrainer.git cd T2ITrainer

Virtual Environment 🛠️

python -m venv venv call venv\Scripts\activate pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

Model Downloads 📥

# Kolors huggingface-cli download Kwai-Kolors/Kolors --local-dir kolors_models/ # NF4 Flux Fill for low gpu huggingface-cli download "lrzjason/flux-fill-nf4" --local-dir flux_models/fill/ # skip if downloaded nf 4 Flux Fill huggingface-cli download "black-forest-labs/FLUX.1-fill-dev" --local-dir flux_models/fill/ # SD3.5 Models huggingface-cli download "stabilityai/stable-diffusion-3.5-large" --local-dir "sd3.5L/" # NF4 Flux kontext huggingface-cli download "lrzjason/flux-kontext-nf4" --local-dir flux_models/kontext/

Folder Structure

flux_models:

flux_models

kontext:

kontext

🚀 Launch Options

ScriptCommandSpecial Notes
Flux kontextpython ui_flux_fill.pyRequires diffusers>=0.32.0, 24GB VRAM Recommended
Flux Fillpython ui_flux_fill.pyRequires diffusers>=0.32.0, 24GB VRAM Recommended
Kolorspython ui.pyNeeds Fixed VAE
SD3.5 Largepython ui_sd35.py24GB VRAM Recommended

🔧 Parameter Configuration Guide

CivitAI Article


🌌 Flux Model Management

Kontext Model Installation

Inpainting Model Setup

huggingface-cli download "lrzjason/flux-kontext-nf4" --local-dir flux_models/kontext/

For more details (example dataset):

Fill Model Installation (Skip if train kontext)

Inpainting Model Setup

huggingface-cli download "lrzjason/flux-fill-nf4" --local-dir flux_models/fill/

For more details (example dataset):

Dev Model Download (Skip if train fill and kontext)

Dev Model Installation

huggingface-cli download "black-forest-labs/FLUX.1-dev" --local-dir flux_models/dev/

⚙️ Flux Training Recommended Parameters

CategorySettings
Base ConfigurationRank 16, AdamW, Lr 1e-4
24GB GPU512 resolution, Batch Size 1
VRAM OptimizationUse nf4 based training
Precisionbf16

💻 VRAM Usage nf4

VRAM Peak

💻 VRAM Usage (bf16, blocks_to_swap=10)

VRAM Peak
VRAM Low

🔧 Visualize Training Data

Register WandB before using it Setup WandB env

pip install wandb wandb login

Install Tensorboard first if you choice to use Tensorboard To visualize training data, run the following command in your terminal:

tensorboard --logdir=.\logs

🔧 Kolors Testing & Integration

  • Kolors Workflow:

    # ComfyUI Plugins git clone https://github.com/kijai/ComfyUI-KwaiKolorsWrapper git clone https://github.com/MinusZoneAI/ComfyUI-Kolors-MZ
  • Configuration Guide: 📖 CivitAI Article

🆘 Troubleshooting

  • Kolors Black Image Issue: Ensure you're using FP16 Fixed VAE
  • VRAM Limitations: Adjust blocks_to_swap parameter (higher values reduce memory usage)
  • Windows DLL Errors: Verify VC++ Redistributable installation

Star History

Star History Chart

Old Change logs:

Recent Change Logs:

  • 2025-07-20: Support to user original kontext repo to train lora. --exclude "*.safetensors" skip the big one model file which is not needed.
huggingface-cli download "black-forest-labs/FLUX.1-Kontext-dev" --local-dir flux_models/kontext_full/ --exclude "*.safetensors"
  • 2025-07-16:
    add --config_path argument to train_flux_lora_ui_kontext.py support config file to start the kontext training
python train_flux_lora_ui_kontext.py --config_path config.json

Sponsor:

  • Thanks to @sourceful support me making flux fill lora training script.

📬 Contact

Sponsors me for more open source projects:

Buy me a coffee:

Buy Me a Coffee QR

WeChat:

WeChat QR

Acknowledgements:

  • Thanks to chenpipi0807 for Chinese translation and language switch support
  • Thanks for diffusers and Terminus Research Group
  • Thanks to minienglish1 and Freon in EveryDream Discord for the assistance.
  • Special thanks to kohya ss for references from the training codebase.
  • Thanks to Kblueleaf for coding reference on hunyuandit gradient checkpoint implementation.
  • Thanks to Kolors for the open-source checkpoint.
  • Thanks to comfyui for the wonderful codebase.
  • Thanks to emojiiii for the setup.bat script and other updates.
  • Thanks to Rohit Gandikota and related authors of Concept Sliders https://github.com/rohitgandikota/sliders