Kandinsky LoRA Training

November 25, 2025 ยท View on GitHub

This README provides a quick and practical guide for preparing data, configuring training, and running LoRA fine-tuning for Kandinsky models.


๐Ÿš€ 1. Clone the Repository and Submodule

After clone this repo don't forget do:

git submodule update --init --remote

๐Ÿ“ฅ 2. Download Models

Download all required pretrained models with kandinsky5/download_models.py and place them into:

kandinsky5/weights

๐ŸŽฌ 3. Prepare Your Data

Prepare a directory containing pairs:

  • *.mp4 or *.png
  • *.txt โ€” caption for the same sample

Then:

  1. Open encode/encode.sh
  2. Set correct local paths for input data and output directories
  3. Run:
bash encode/encode.sh

This will generate:

  • cache/latents_image/
  • cache/text_embeds/

โš™๏ธ 4. Configure Training

Choose a config:

  • T2I โ†’ configs/lora_image.yaml
  • T2V / I2V โ†’ configs/lora_video.yaml

Update in the selected config:

  • experiment_dir
  • log_dir
  • checkpoint_dir

Then edit dataloader configs: configs/data/lora_*_dataloader.yaml.

Set:

  • latents_dir โ†’ path to latents from Step 3
  • text_embeds_dir โ†’ path to text embeds from Step 3
  • uncond_embed โ†’ text_embeds_dir + /null.pt

๐Ÿงฉ 5. GPU & LoRA Setup

Edit:

configs/trainer/lora*.yaml

Configure:

  • devices โ†’ number of GPUs
  • Optional: LoRA architecture parameters

โ–ถ๏ธ 6. Start Training

Choose the correct config inside train.sh:

  • configs/lora_video.yaml for T2V / I2V
  • configs/lora_image.yaml for T2I

Correct --nproc_per_node on your number of GPUs and then run:

bash train.sh

Note: FSDP is enabled by default.