File size: 13,293 Bytes
1b75ef9 8c10eec 1b75ef9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
---
license: apache-2.0
---
<div align="center">
<picture>
<img src="assets/KANDINSKY_LOGO_1_BLACK.png">
</picture>
</div>
<div align="center">
<a href="">Habr</a> | <a href="https://gen-ai-team.github.io/kandinsky-5-inference/">Project Page</a> | Technical Report (soon) | <a href=https://huggingface.co/collections/ai-forever/kandisnky-50-t2v-lite-68d71892d2cc9b02177e5ae5> Modelsπ€ </a>
</div>
<h1>Kandinsky 5.0: A family of diffusion models for Video & Image generation</h1>
In this repository, we provide a family of diffusion models to generate a video or an image (<em>Coming Soon</em>) given a textual prompt and distilled model for faster generation.
https://github.com/user-attachments/assets/b9ff0417-02a4-4f6b-aacc-60c44e7fe6f1
## Project Updates
- π₯ **Source**: ```2025/09/29```: We have open-sourced `Kandinsky 5.0 T2V Lite` a lite (2B parameters) version of `Kandinsky 5.0 Video` text-to-video generation model. Released checkpoints: `kandinsky5lite_t2v_pretrain_5s`, `kandinsky5lite_t2v_pretrain_10s`, `kandinsky5lite_t2v_sft_5s`, `kandinsky5lite_t2v_sft_10s`, `kandinsky5lite_t2v_nocfg_5s`, `kandinsky5lite_t2v_nocfg_10s`, `kandinsky5lite_t2v_distilled16steps_5s`, `kandinsky5lite_t2v_distilled16steps_10s` contains weight from pretrain, supervised finetuning, cfg distillation and distillation in 16 steps. 5s checkpoints are capable of generating videos up to 5 seconds long. 10s checkpoints is faster models checkpoints trained with [NABLA](https://huggingface.co/ai-forever/Wan2.1-T2V-14B-NABLA-0.7) algorithm and capable to generate videos up to 10 seconds long.
## Kandinsky 5.0 T2V Lite
Kandinsky 5.0 T2V Lite is a lightweight video generation model (2B parameters) that ranks #1 among open-source models in its class. It outperforms larger Wan models (5B and 14B) and offers the best understanding of Russian concepts in the open-source ecosystem.
We provide 8 model variants, each optimized for different use cases:
* SFT model β delivers the highest generation quality;
* CFG-distilled β runs 2Γ faster;
* Diffusion-distilled β enables low-latency generation with minimal quality loss (6Γ faster);
* Pretrain model β designed for fine-tuning by researchers and enthusiasts.
All models are available in two versions: for generating 5-second and 10-second videos.
## Pipeline
**Latent diffusion pipeline** with **Flow Matching**.
**Diffusion Transformer (DiT)** as the main generative backbone with **cross-attention to text embeddings**.
- **Qwen2.5-VL** and **CLIP** provides text embeddings.
- **HunyuanVideo 3D VAE** encodes/decodes video into a latent space.
- **DiT** is the main generative module using cross-attention to condition on text.
<img width="1600" height="477" alt="Picture1" src="https://github.com/user-attachments/assets/17fc2eb5-05e3-4591-9ec6-0f6e1ca397b3" />
<img width="800" height="406" alt="Picture2" src="https://github.com/user-attachments/assets/f3006742-e261-4c39-b7dc-e39330be9a09" />
## Model Zoo
| Model | config | video duration | NFE | Checkpoint | Latency* (H100) | VBench score |
|-------------------------------------|--------|----------------|-----|------------|----------------|--------------|
| Kandinsky 5.0 T2V Lite SFT 5s |configs/config_5s_sft.yaml | 5s | 100 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-sft-5s) | 139 s | 84.02 |
| Kandinsky 5.0 T2V Lite SFT 10s |configs/config_10s_sft.yaml| 10s | 100 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-sft-10s) | 224 s | 85.36 |
| Kandinsky 5.0 T2V Lite pretrain 5s |configs/config_5s_pretrain.yaml | 5s | 100 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-pretrain-5s) | 139 s | |
| Kandinsky 5.0 T2V Lite pretrain 10s |configs/config_10s_pretrain.yaml | 10s | 100 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-pretrain-10s) | 224 s | |
| Kandinsky 5.0 T2V Lite no-CFG 5s |configs/config_5s_nocfg.yaml| 5s | 50 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-5s) | 77 s | |
| Kandinsky 5.0 T2V Lite no-CFG 10s |configs/config_10s_nocfg.yaml| 10s | 50 |π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-nocfg-10s) | 124 s | |
| Kandinsky 5.0 T2V Lite distill 5s |configs/config_5s_distil.yaml| 5s | 16 | π€ [HF](https://huggingface.co/ai-forever/Kandinsky-5.0-T2V-Lite-distilled16steps-5s)| 35 s | |
| Kandinsky 5.0 T2V Lite distill 10s | | 10s | 16 | | 55 s | |
*Latency was measured after the second inference run. The first run of the model can be slower due to the compilation process. For 5-second models Flash Attention 3 was used.
### Examples:
#### Kandinsky 5.0 T2V Lite SFT
<table border="0" style="width: 200; text-align: left; margin-top: 20px;">
<tr>
<td>
<video src="https://github.com/user-attachments/assets/bc38821b-f9f1-46db-885f-1f70464669eb" width=200 controls autoplay loop></video>
</td>
<td>
<video src="https://github.com/user-attachments/assets/9f64c940-4df8-4c51-bd81-a05de8e70fc3" width=200 controls autoplay loop></video>
</td>
<tr>
<td>
<video src="https://github.com/user-attachments/assets/77dd417f-e0bf-42bd-8d80-daffcd054add" width=200 controls autoplay loop></video>
</td>
<td>
<video src="https://github.com/user-attachments/assets/385a0076-f01c-4663-aa46-6ce50352b9ed" width=200 controls autoplay loop></video>
</td>
<tr>
<td>
<video src="https://github.com/user-attachments/assets/7c1bcb31-cc7d-4385-9a33-2b0cc28393dd" width=200 controls autoplay loop></video>
</td>
<td>
<video src="https://github.com/user-attachments/assets/990a8a0b-2df1-4bbc-b2e3-2859b6f1eea6" width=200 controls autoplay loop></video>
</td>
</tr>
</table>
#### Kandinsky 5.0 T2V Lite Distill
<table border="0" style="width: 200; text-align: left; margin-top: 20px;">
<tr>
<td>
<video src="https://github.com/user-attachments/assets/861342f9-f576-4083-8a3b-94570a970d58" width=200 controls autoplay loop></video>
</td>
<td>
<video src="https://github.com/user-attachments/assets/302e4e7d-781d-4a58-9b10-8c473d469c4b" width=200 controls autoplay loop></video>
</td>
<tr>
<td>
<video src="https://github.com/user-attachments/assets/3e70175c-40e5-4aec-b506-38006fe91a76" width=200 controls autoplay loop></video>
</td>
<td>
<video src="https://github.com/user-attachments/assets/b7da85f7-8b62-4d46-9460-7f0e505de810" width=200 controls autoplay loop></video>
</td>
</table>
### Results:
#### Side-by-Side evaluation
The evaluation is based on the expanded prompts from the [Movie Gen benchmark](https://github.com/facebookresearch/MovieGenBench), which are available in the expanded_prompt column of the benchmark/moviegen_bench.csv file.
<table border="0" style="width: 400; text-align: left; margin-top: 20px;">
<tr>
<td>
<img src="assets/sbs/kandinsky_5_video_lite_vs_sora.jpg" width=400 ></img>
</td>
<td>
<img src="assets/sbs/kandinsky_5_video_lite_vs_wan_2.1_14B.jpg" width=400 ></img>
</td>
<tr>
<td>
<img src="assets/sbs/kandinsky_5_video_lite_vs_wan_2.2_5B.jpg" width=400 ></img>
</td>
<td>
<img src="assets/sbs/kandinsky_5_video_lite_vs_wan_2.2_A14B.jpg" width=400 ></img>
</td>
</table>
#### VBench results
<div align="center">
<picture>
<img src="assets/vbench.png">
</picture>
</div>
## Quickstart
#### Installation
Clone the repo:
```sh
git clone https://github.com/ai-forever/Kandinsky-5.git
cd Kandinsky-5
```
Install dependencies:
```sh
pip install -r requirements.txt
```
To improve inference performance on NVidia Hopper GPUs, we recommend installing [Flash Attention 3](https://github.com/Dao-AILab/flash-attention/?tab=readme-ov-file#flashattention-3-beta-release).
#### Model Download
```sh
python download_models.py
```
#### Run Kandinsky 5.0 T2V Lite SFT 5s
```sh
python test.py --prompt "A dog in red hat"
```
#### Run Kandinsky 5.0 T2V Lite SFT 10s
```sh
python test.py --config ./configs/config_10s_sft.yaml --prompt "A dog in red hat" --video_duration 10
```
#### Run Kandinsky 5.0 T2V Lite pretrain 5s
```sh
python test.py --config ./configs/config_5s_pretrain.yaml --prompt "A dog in red hat"
```
#### Run Kandinsky 5.0 T2V Lite pretrain 10s
```sh
python test.py --config ./configs/config_10s_pretrain.yaml --prompt "A dog in red hat" --video_duration 10
```
#### Run Kandinsky 5.0 T2V Lite no-CFG 5s
```sh
python test.py --config ./configs/config_5s_nocfg.yaml --prompt "A dog in red hat"
```
#### Run Kandinsky 5.0 T2V Lite no-CFG 10s
```sh
python test.py --config ./configs/config_10s_nocfg.yaml --prompt "A dog in red hat" --video_duration 10
```
#### Run Kandinsky 5.0 T2V Lite distill 5s
```sh
python test.py --config ./configs/config_5s_distil.yaml --prompt "A dog in red hat"
```
#### Run Kandinsky 5.0 T2V Lite distill 10s
Coming soon
### Inference
```python
import torch
from IPython.display import Video
from kandinsky import get_T2V_pipeline
device_map = {
"dit": torch.device('cuda:0'),
"vae": torch.device('cuda:0'),
"text_embedder": torch.device('cuda:0')
}
pipe = get_T2V_pipeline(device_map, conf_path="configs/config_5s_sft.yaml")
images = pipe(
seed=42,
time_length=5,
width=768,
height=512,
save_path="./test.mp4",
text="A cat in a red hat",
)
Video("./test.mp4")
```
Please, refer to [inference_example.ipynb](inference_example.ipynb) notebook for more usage details.
### Distributed Inference
For a faster inference, we also provide the capability to perform inference in a distributed way:
```
NUMBER_OF_NODES=1
NUMBER_OF_DEVICES_PER_NODE=1 / 2 / 4
python -m torch.distributed.launch --nnodes $NUMBER_OF_NODES --nproc-per-node $NUMBER_OF_DEVICES_PER_NODE test.py
```
### ComfyUI
See the instruction [here](comfyui)
## π Todo List
- Kandinsky 5.0 Lite Text-to-Video
- [x] Multi-GPU Inference code of the 2B models
- [ ] Checkpoints 2B models
- [x] pretrain
- [x] sft
- [ ] rl
- [x] cfg distil
- [x] distil 16 steps
- [ ] autoregressive generation
- [x] ComfyUI integration
- [ ] Diffusers integration
- [ ] Caching acceleration support
- Kandinsky 5.0 Lite Image-to-Video
- [ ] Multi-GPU Inference code of the 2B model
- [ ] Checkpoints of the 2B model
- [ ] ComfyUI integration
- [ ] Diffusers integration
- Kandinsky 5.0 Pro Text-to-Video
- [ ] Multi-GPU Inference code of the models
- [ ] Checkpoints of the model
- [ ] ComfyUI integration
- [ ] Diffusers integration
- Kandinsky 5.0 Pro Image-to-Video
- [ ] Multi-GPU Inference code of the model
- [ ] Checkpoints of the model
- [ ] ComfyUI integration
- [ ] Diffusers integration
- [ ] Technical report
# Authors
<B>Project Leader:</B> Denis Dimitrov</br>
<B>Team Leads:</B> Vladimir Arkhipkin, Vladimir Korviakov, Nikolai Gerasimenko, Denis Parkhomenko</br>
<B>Core Contributors:</B> Alexey Letunovskiy, Maria Kovaleva, Ivan Kirillov, Lev Novitskiy, Denis Koposov, Dmitrii Mikhailov, Anna Averchenkova, Andrey Shutkin, Julia Agafonova, Olga Kim, Anastasiia Kargapoltseva, Nikita Kiselev</br>
<B>Contributors:</B> Anna Dmitrienko, Anastasia Maltseva, Kirill Chernyshev, Ilia Vasiliev, Viacheslav Vasilev, Vladimir Polovnikov, Yury Kolabushin, Alexander Belykh, Mikhail Mamaev, Anastasia Aliaskina, Tatiana Nikulina, Polina Gavrilova</br>
# Citation
```
@misc{kandinsky2025,
author = {Alexey Letunovskiy, Maria Kovaleva, Ivan Kirillov, Lev Novitskiy, Denis Koposov,
Dmitrii Mikhailov, Anna Averchenkova, Andrey Shutkin, Julia Agafonova, Olga Kim,
Anastasiia Kargapoltseva, Nikita Kiselev, Vladimir Arkhipkin, Vladimir Korviakov,
Nikolai Gerasimenko, Denis Parkhomenko, Anna Dmitrienko, Anastasia Maltseva,
Kirill Chernyshev, Ilia Vasiliev, Viacheslav Vasilev, Vladimir Polovnikov,
Yury Kolabushin, Alexander Belykh, Mikhail Mamaev, Anastasia Aliaskina,
Tatiana Nikulina, Polina Gavrilova, Denis Dimitrov},
title = {Kandinsky 5.0: A family of diffusion models for Video & Image generation},
howpublished = {\url{https://github.com/ai-forever/Kandinsky-5}},
year = 2025
}
@misc{mikhailov2025nablanablaneighborhoodadaptiveblocklevel,
title={$\nabla$NABLA: Neighborhood Adaptive Block-Level Attention},
author={Dmitrii Mikhailov and Aleksey Letunovskiy and Maria Kovaleva and Vladimir Arkhipkin
and Vladimir Korviakov and Vladimir Polovnikov and Viacheslav Vasilev
and Evelina Sidorova and Denis Dimitrov},
year={2025},
eprint={2507.13546},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2507.13546},
}
``` |