https://github.com/ai-forever/kandinsky-3
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.1%) to scientific vocabulary
Keywords from Contributors
Repository
Basic Info
- Host: GitHub
- Owner: ai-forever
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://ai-forever.github.io/Kandinsky-3/
- Size: 304 MB
Statistics
- Stars: 365
- Watchers: 14
- Forks: 35
- Open Issues: 11
- Releases: 0
Metadata Files
README.md
Kandinsky-3: Text-to-image diffusion model

Kandinsky 3.0 Post | Kandinsky 3.1 Post | Project Page | Generate | Telegram-bot | Technical Report | HuggingFace |
Kandinsky 3.1:
Description:
We present Kandinsky 3.1, the follow-up to the Kandinsky 3.0 model, a large-scale text-to-image generation model based on latent diffusion, continuing the series of text-to-image Kandinsky models and reflecting our progress to achieve higher quality and realism of image generation, which we have enhanced and enriched with a variety of useful features and modes to give users more opportunities to fully utilise the power of our new model.
Kandinsky Flash (Kandinsky 3.0 Refiner)
Diffusion models have problems with fast image generation. To address this problem, we trained a Kandinksy Flash model based on the Adversarial Diffusion Distillation approach with some modifications: we trained the model on latents, which reduced the memory overhead and removed distillation loss as it did not affect the training. Also, we applied Kandinsky Flash model to images generated from Kandinsky 3.0 to improve visual quality of generated images.
Architecture
For training Kandinsky Flash we used the following architecture of discriminator. It is the half of Kandinsky 3.0 U-Net encoder with additional head predictions.

How to use:
Check our jupyter notebooks with examples in ./examples folder
```python from kandinsky3 import getT2IFlash_pipeline
devicemap = torch.device('cuda:0') dtypemap = { 'unet': torch.float32, 'text_encoder': torch.float16, 'movq': torch.float32, }
t2ipipe = getT2IFlashpipeline( devicemap, dtypemap )
res = t2i_pipe("A cute corgi lives in a house made out of sushi.") ```
Kandinsky Inpainting
Also, we released a newer version of inpainting model, which we additionally trained the model on the object detection dataset. This allowed to get more stable generation of objects. The new weights are available at ai-forever/Kandinsky3.1. Check the usage example.
Prompt beautification
Prompt plays crucial role in text-to-image generation. So, in Kandinsky 3.1 we decided to use language model for making prompt better. We used Intel's neural-chat-7b-v3-1 with the following system prompt as the LLM:
```
System: You are a prompt engineer. Your mission is to expand prompts written by user. You should provide the best prompt for text to image generation in English.
User:
{prompt}
Assistant:
{answer of the model} ```
KandiSuperRes
To learn more about KandiSuperRes, please checkout: https://github.com/ai-forever/KandiSuperRes/
Kandinsky IP-Adapter & Kandinsky ControlNet
To allow using image as condition in Kandinsky model, we trained IP-Adapter and HED-based ControlNet model. For more details please check out: https://github.com/ai-forever/kandinsky3-diffusers
Kandinsky 3.0:
Description:
Kandinsky 3.0 is an open-source text-to-image diffusion model built upon the Kandinsky2-x model family. In comparison to its predecessors, Kandinsky 3.0 incorporates more data and specifically related to Russian culture, which allows to generate pictures related to Russin culture. Furthermore, enhancements have been made to the text understanding and visual quality of the model, achieved by increasing the size of the text encoder and Diffusion U-Net models, respectively.
For more information: details of training, example of generations check out our post. The english version will be released in a couple of days.
Architecture details:

Architecture consists of three parts:
- Text encoder Flan-UL2 (encoder part) - 8.6B
- Latent Diffusion U-Net - 3B
- MoVQ encoder/decoder - 267M
Models
We release our two models:
- Base: Base text-to-image diffusion model. This model was trained over 2M steps on 400 A100
- Inpainting: Inpainting version of the model. The model was initialized from final checkpoint of base model and trained 250k steps on 300 A100.
Installing
To install repo first one need to create conda environment:
conda create -n kandinsky -y python=3.8;
source activate kandinsky;
pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu113/torch_stable.html;
pip install -r requirements.txt;
The exact dependencies is got using pip freeze and can be found in exact_requirements.txt
How to use:
Check our jupyter notebooks with examples in ./examples folder
1. text2image
```python import sys sys.path.append('..')
import torch from kandinsky3 import getT2Ipipeline
devicemap = torch.device('cuda:0') dtypemap = { 'unet': torch.float32, 'text_encoder': torch.float16, 'movq': torch.float32, }
t2ipipe = getT2Ipipeline( devicemap, dtypemap, ) res = t2ipipe("A cute corgi lives in a house made out of sushi.")
res[0] ```
2. inpainting
```python from kandinsky3 import getinpaintingpipeline
devicemap = torch.device('cuda:0') dtypemap = { 'unet': torch.float16, 'text_encoder': torch.float16, 'movq': torch.float32, }
inppipe = getinpaintingpipeline( devicemap, dtype_map, )
image = ... # PIL Image mask = ... # Numpy array (HxW). Set 1 where image should be masked image = inp_pipe( "A cute corgi lives in a house made out of sushi.", image, mask) ```
Examples of generations
![]() |
![]() |
![]() |
![]() |
| "A beautiful landscape outdoors scene in the crochet knitting art style, drawing in style by Alfons Mucha" | "gorgeous phoenix, cosmic, darkness, epic, cinematic, moonlight, stars, high - definition, texture,Oscar-Claude Monet" | "a yellow house at the edge of the danish fjord, in the style of eiko ojala, ingrid baars, ad posters, mountainous vistas, george ault, realistic details, dark white and dark gray, 4k" | "dragon fruit head, upper body, realistic, illustration by Joshua Hoffine Norman Rockwell, scary, creepy, biohacking, futurism, Zaha Hadid style" |
![]() |
![]() |
![]() |
![]() |
| "Amazing playful nice cute strawberry character, dynamic poze, surreal fantazy garden background, gorgeous masterpice, award winning photo, soft natural lighting, 3d, Blender, Octane render, tilt - shift, deep field, colorful, I can't believe how beautiful this is, colorful, cute and sweet baby - loved photo" | "beautiful fairy-tale desert, in the sky a wave of sand merges with the milky way, stars, cosmism, digital art, 8k" | "Car, mustang, movie, person, poster, car cover, person, in the style of alessandro gottardo, gold and cyan, gerald harvey jones, reflections, highly detailed illustrations, industrial urban scenes"" | "cloud in blue sky, a red lip, collage art, shuji terayama, dreamy objects, surreal, criterion collection, showa era, intricate details, mirror" |
Authors
- Vladimir Arkhipkin: Github
- Anastasia Maltseva Github
- Andrei Filatov Github,
- Igor Pavlov: Github
- Julia Agafonova
- Arseniy Shakhmatov: Github, Blog
- Andrey Kuznetsov: Github, Blog
- Denis Dimitrov: Github, Blog
Citation
bibtex
@inproceedings{vladimir-etal-2024-kandinsky,
title = "Kandinsky 3: Text-to-Image Synthesis for Multifunctional Generative Framework",
author = "Vladimir, Arkhipkin and
Vasilev, Viacheslav and
Filatov, Andrei and
Pavlov, Igor and
Agafonova, Julia and
Gerasimenko, Nikolai and
Averchenkova, Anna and
Mironova, Evelina and
Anton, Bukashkin and
Kulikov, Konstantin and
Kuznetsov, Andrey and
Dimitrov, Denis",
editor = "Hernandez Farias, Delia Irazu and
Hope, Tom and
Li, Manling",
booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
month = nov,
year = "2024",
address = "Miami, Florida, USA",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.emnlp-demo.48",
pages = "475--485",
abstract = "Text-to-image (T2I) diffusion models are popular for introducing image manipulation methods, such as editing, image fusion, inpainting, etc. At the same time, image-to-video (I2V) and text-to-video (T2V) models are also built on top of T2I models. We present Kandinsky 3, a novel T2I model based on latent diffusion, achieving a high level of quality and photorealism. The key feature of the new architecture is the simplicity and efficiency of its adaptation for many types of generation tasks. We extend the base T2I model for various applications and create a multifunctional generation system that includes text-guided inpainting/outpainting, image fusion, text-image fusion, image variations generation, I2V and T2V generation. We also present a distilled version of the T2I model, evaluating inference in 4 steps of the reverse process without reducing image quality and 3 times faster than the base model. We deployed a user-friendly demo system in which all the features can be tested in the public domain. Additionally, we released the source code and checkpoints for the Kandinsky 3 and extended models. Human evaluations show that Kandinsky 3 demonstrates one of the highest quality scores among open source generation systems.",
}
bibtex
@misc{arkhipkin2023kandinsky,
title={Kandinsky 3.0 Technical Report},
author={Vladimir Arkhipkin and Andrei Filatov and Viacheslav Vasilev and Anastasia Maltseva and Said Azizov and Igor Pavlov and Julia Agafonova and Andrey Kuznetsov and Denis Dimitrov},
year={2023},
eprint={2312.03511},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
Owner
- Name: AI Forever
- Login: ai-forever
- Kind: organization
- Location: Armenia
- Repositories: 60
- Profile: https://github.com/ai-forever
Creating ML for the future. AI projects you already know. We are non-profit organization with members from all over the world.
GitHub Events
Total
- Issues event: 1
- Watch event: 65
- Issue comment event: 2
- Push event: 3
- Pull request event: 2
- Fork event: 8
Last Year
- Issues event: 1
- Watch event: 65
- Issue comment event: 2
- Push event: 3
- Pull request event: 2
- Fork event: 8
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Andrei Filatov | 4****h | 29 |
| Zein Shaheen | z****e@g****m | 24 |
| Arkhipkin Vladimir | 3****e | 10 |
| boomb0om | i****1@g****m | 6 |
| Leon Wu | l****b@g****m | 2 |
| Kurra Vishnuvardhan | 1****1 | 1 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 20
- Total pull requests: 6
- Average time to close issues: about 2 months
- Average time to close pull requests: 18 days
- Total issue authors: 16
- Total pull request authors: 3
- Average comments per issue: 0.95
- Average comments per pull request: 0.67
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 14 days
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- kebijuelun (2)
- MahdiMohseni0033 (2)
- EYcab (2)
- trouble-maker007 (2)
- kranmer (1)
- slivka83 (1)
- aspctu (1)
- olefirenko (1)
- vsevolod-oparin (1)
- americanexplorer13 (1)
- CuteBadEgg (1)
- Zeqiang-Lai (1)
- AyYildizPilot (1)
- Bigfield77 (1)
- Quick-Eyed-Sky (1)
Pull Request Authors
- anvilarth (2)
- Vishnukurra101 (2)
- LWprogramming (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- Babel ==2.9.1
- Cython ==0.29.26
- DAWG-Python ==0.7.2
- Deprecated ==1.2.13
- Flask ==2.0.2
- GPUtil ==1.4.0
- GitPython ==3.1.26
- HeapDict ==1.0.1
- Mako ==1.1.6
- Markdown ==3.3.6
- Pillow ==9.0.0
- PyJWT ==2.3.0
- PyWavelets ==1.3.0
- Pygments ==2.16.1
- SQLAlchemy ==1.3.13
- Send2Trash ==1.8.0
- SoundFile ==0.10.3.post1
- Werkzeug ==2.0.2
- absl-py ==1.0.0
- accelerate ==0.20.3
- adal ==1.2.7
- addict ==2.4.0
- aioboto3 ==11.0.1
- aiobotocore ==2.4.2
- aiofiles ==23.2.1
- aiohttp ==3.8.1
- aiohttp-cors ==0.7.0
- aioitertools ==0.11.0
- aioredis ==1.3.1
- aiosignal ==1.2.0
- albumentations ==1.3.1
- alembic ==1.4.1
- alt-profanity-check ==1.0.1
- altair ==5.0.1
- antlr4-python3-runtime ==4.9.3
- anyio ==3.5.0
- apex ==0.1
- appdirs ==1.4.4
- argon2-cffi ==21.3.0
- argon2-cffi-bindings ==21.2.0
- asgiref ==3.4.1
- astunparse ==1.6.3
- async-timeout ==4.0.2
- asyncpool ==1.0
- asynctest ==0.13.0
- attrs ==21.4.0
- audioread ==2.1.9
- autopage ==0.4.0
- avro ==1.11.0
- awscli ==1.22.38
- azure-common ==1.1.27
- azure-storage-blob ==2.1.0
- azure-storage-common ==2.1.0
- backcall ==0.2.0
- basicsr ==1.4.2
- bezier ==2021.2.12
- bitarray ==2.8.3
- bitmath ==1.3.3.1
- bleach ==4.1.0
- blessings ==1.7
- blis ==0.7.11
- bokeh ==2.4.2
- boto3 ==1.24.59
- botocore ==1.27.59
- braceexpand ==0.1.7
- cached-property ==1.5.2
- cachetools ==4.2.4
- catalogue ==2.0.10
- certifi ==2021.10.8
- cffi ==1.15.0
- charset-normalizer ==2.0.10
- click ==8.0.3
- cliff ==3.10.0
- cloudevents ==1.2.0
- cloudpathlib ==0.16.0
- cloudpickle ==2.0.0
- cmaes ==0.8.2
- cmake ==3.27.7
- cmd2 ==2.3.3
- colorama ==0.4.3
- colorful ==0.5.4
- colorlog ==6.6.0
- conda ==4.11.0
- conda-build ==3.21.7
- confection ==0.1.3
- configparser ==5.2.0
- cycler ==0.11.0
- cymem ==2.0.8
- dask ==2022.1.0
- databricks-cli ==0.16.2
- datasets ==2.13.2
- debugpy ==1.5.1
- decorator ==5.1.1
- deep-translator ==1.11.4
- defusedxml ==0.7.1
- deprecation ==2.1.0
- diffusers ==0.21.4
- dill ==0.3.6
- distributed ==2022.1.0
- docker ==5.0.3
- docker-pycreds ==0.4.0
- docopt ==0.6.2
- docutils ==0.15.2
- einops ==0.6.1
- entrypoints ==0.3
- fairscale ==0.4.6
- fairseq ==0.12.2
- fastBPE ==0.1.0
- fastapi ==0.72.0
- fasttext ==0.9.2
- fasttext-langdetect ==1.0.5
- ffmpy ==0.3.1
- fonttools ==4.28.5
- fpie ==0.2.4
- frozenlist ==1.3.0
- fsspec ==2023.1.0
- ftfy ==6.1.1
- future ==0.18.2
- gitdb ==4.0.9
- glob2 ==0.7
- google-api-core ==2.4.0
- google-auth ==1.35.0
- google-auth-oauthlib ==0.4.6
- google-cloud-core ==2.2.2
- google-cloud-language ==2.3.1
- google-cloud-storage ==2.0.0
- google-crc32c ==1.3.0
- google-resumable-media ==2.1.0
- googleapis-common-protos ==1.54.0
- gorilla ==0.4.0
- gpustat ==0.6.0
- gradio ==3.34.0
- gradio_client ==0.2.6
- grpcio ==1.43.0
- grpcio-status ==1.43.0
- gunicorn ==20.1.0
- h11 ==0.14.0
- h5py ==3.6.0
- hiredis ==2.0.0
- horovod ==0.28.1
- httpcore ==0.17.3
- httpx ==0.24.1
- huggingface-hub ==0.16.4
- hydra-core ==1.3.2
- idna ==3.3
- imageio ==2.31.2
- importlib-metadata ==4.10.1
- importlib-resources ==5.4.0
- inflect ==5.3.0
- intervaltree ==3.1.0
- ipykernel ==6.7.0
- ipymarkup ==0.9.0
- ipyplot ==1.1.1
- ipython ==7.31.1
- ipython-genutils ==0.2.0
- ipywidgets ==7.6.5
- itsdangerous ==2.0.1
- jedi ==0.18.1
- jmespath ==0.10.0
- joblib ==1.1.0
- json5 ==0.9.6
- jsonschema ==4.4.0
- jupyter-archive ==3.2.1
- jupyter-client ==7.1.2
- jupyter-core ==4.9.1
- jupyter-server ==1.13.4
- jupyter-server-proxy ==1.3.2
- jupyterlab ==3.3.0a2
- jupyterlab-nvdashboard ==0.6.0
- jupyterlab-pygments ==0.1.2
- jupyterlab-server ==2.10.3
- jupyterlab-widgets ==1.0.2
- kfserving ==0.6.1
- kiwisolver ==1.3.2
- kubernetes ==21.7.0
- langcodes ==3.3.0
- langid ==1.1.6
- librosa ==0.8.1
- linkify-it-py ==2.0.2
- llvmlite ==0.38.0
- lmdb ==1.4.1
- locket ==0.2.1
- markdown-it-py ==2.2.0
- matplotlib ==3.5.1
- matplotlib-inline ==0.1.3
- mdit-py-plugins ==0.3.3
- mdurl ==0.1.2
- minio ==6.0.2
- mistune ==0.8.4
- mmcv-full ==1.4.3
- modin ==0.12.1
- mpi4py ==3.1.3
- msgpack ==1.0.3
- multidict ==5.2.0
- multiprocess ==0.70.14
- murmurhash ==1.0.10
- natasha ==1.6.0
- navec ==0.10.0
- nbclassic ==0.3.5
- nbclient ==0.5.10
- nbconvert ==6.4.1
- nbformat ==5.1.3
- nest-asyncio ==1.5.4
- networkx ==2.6.3
- nltk ==3.6.7
- npm ==0.1.1
- numba ==0.55.0
- numpy ==1.21.5
- nvidia-ml-py3 ==7.352.0
- oauthlib ==3.1.1
- omegaconf ==2.3.0
- opencensus ==0.8.0
- opencensus-context ==0.1.2
- opencv-python ==4.5.5.62
- opencv-python-headless ==4.8.1.78
- optional-django ==0.1.0
- optuna ==2.10.0
- orjson ==3.9.7
- packaging ==21.3
- pandas ==1.3.5
- pandocfilters ==1.5.0
- parso ==0.8.3
- partd ==1.2.0
- pbr ==5.8.0
- pexpect ==4.8.0
- pickleshare ==0.7.5
- pooch ==1.5.2
- portalocker ==2.3.2
- preshed ==3.0.9
- prettytable ==3.0.0
- prometheus-client ==0.13.0
- prometheus-flask-exporter ==0.18.7
- prompt-toolkit ==3.0.26
- proto-plus ==1.19.8
- protobuf ==3.19.3
- ptyprocess ==0.7.0
- py-spy ==0.3.11
- pyDeprecate ==0.3.2
- pyarrow ==12.0.1
- pyasn1 ==0.4.8
- pyasn1-modules ==0.2.8
- pybind11 ==2.11.1
- pycparser ==2.21
- pydantic ==1.9.0
- pydub ==0.25.1
- pyee ==8.2.2
- pymorphy2 ==0.9.1
- pymorphy2-dicts-ru ==2.4.417127.4579844
- pynvml ==11.4.1
- pyparsing ==3.0.7
- pyperclip ==1.8.2
- pyppeteer ==0.2.6
- pyrsistent ==0.18.1
- python-dateutil ==2.8.2
- python-editor ==1.0.4
- python-multipart ==0.0.6
- python-speech-features ==0.6
- pytorch-lightning ==1.7.5
- pyzmq ==22.3.0
- qudida ==0.0.4
- querystring-parser ==1.2.4
- ray ==1.6.0
- razdel ==0.5.0
- redis ==4.1.1
- regex ==2022.1.18
- requests ==2.27.1
- requests-oauthlib ==1.3.0
- resampy ==0.2.2
- rich ==13.6.0
- rsa ==4.8
- s3fs ==2023.1.0
- s3transfer ==0.6.2
- sacrebleu ==2.0.0
- sacremoses ==0.0.53
- safetensors ==0.4.0
- scikit-image ==0.19.3
- scikit-learn ==1.0.1
- scipy ==1.7.3
- semantic-version ==2.10.0
- sentence-transformers ==2.2.2
- sentencepiece ==0.1.96
- sentry-sdk ==1.34.0
- setproctitle ==1.3.3
- shortuuid ==1.0.11
- simpervisor ==0.4
- simplejson ==3.17.6
- six ==1.16.0
- slovnet ==0.6.0
- smart-open ==6.4.0
- smmap ==5.0.0
- sniffio ==1.2.0
- sortedcontainers ==2.4.0
- sox ==1.4.1
- spacy ==3.7.2
- spacy-legacy ==3.0.12
- spacy-loggers ==1.0.5
- sqlparse ==0.4.2
- srsly ==2.4.8
- starlette ==0.17.1
- stevedore ==3.5.0
- table-logger ==0.3.6
- tabulate ==0.8.9
- taichi ==1.6.0
- tblib ==1.7.0
- tensorboard ==2.11.2
- tensorboard-data-server ==0.6.1
- tensorboard-plugin-wit ==1.8.1
- termcolor ==2.3.0
- terminado ==0.13.1
- testpath ==0.5.0
- thinc ==8.2.1
- threadpoolctl ==3.0.0
- tifffile ==2021.11.2
- timm ==0.9.7
- tokenizers ==0.13.3
- toolz ==0.11.2
- torch ==1.10.1
- torchaudio ==0.10.1
- torchmetrics ==0.11.4
- torchvision ==0.11.2
- tornado ==6.1
- traitlets ==5.1.1
- transformers ==4.30.2
- typer ==0.4.0
- typing_extensions ==4.0.1
- uc-micro-py ==1.0.2
- urllib3 ==1.26.18
- uvicorn ==0.17.0
- wandb ==0.16.0
- wasabi ==1.1.2
- wcwidth ==0.2.5
- weasel ==0.3.4
- webdataset ==0.2.74
- webencodings ==0.5.1
- websocket-client ==1.2.3
- websockets ==11.0.3
- widgetsnbextension ==3.5.2
- wrapt ==1.13.3
- xgboost ==1.5.2
- xxhash ==3.4.1
- yapf ==0.32.0
- yargy ==0.16.0
- yarl ==1.7.2
- zict ==2.0.0
- zipp ==3.7.0
- Pillow *
- accelerate *
- albumentations *
- bezier *
- datasets *
- diffusers *
- einops *
- fsspec *
- huggingface_hub *
- hydra-core *
- matplotlib *
- omegaconf *
- pytorch_lightning ==1.7.5
- s3fs *
- scikit-image *
- scipy *
- setuptools ==59.5.0
- timm *
- torch ==1.10.1
- torchaudio ==0.10.1
- torchvision ==0.11.2
- tqdm *
- transformers *
- wandb *
- webdataset *
- Pillow *
- accelerate *
- albumentations *
- bezier *
- datasets *
- diffusers *
- einops *
- fsspec *
- huggingface_hub *
- hydra-core *
- matplotlib *
- omegaconf *
- pytorch_lightning ==1.7.5
- s3fs *
- scikit-image *
- scipy *
- setuptools ==59.5.0
- timm *
- tqdm *
- transformers *
- wandb *
- webdataset *







