/ Модель

Характеристики

Лицензия
Apache 2.0
Опубликована
10 дек 2023

StableXlL

Генерация изображенийТекст → изображение4 профессии

Производная модели kandinsky-community/kandinsky-2-1. Kandinsky 2.1 — диффузионная модель для создания и текстового редактирования изображений по запросу.

8скачиваний за 30 дней0лайковвеса обновлены10 дек 2023

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Изображения» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели сгенерируют результат по каждой задаче. Опубликованный тест появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Карточка модели 004T/StableXlL на Hugging Face совпадает с карточкой kandinsky-community/kandinsky-2-1, поэтому описание составлено по ней.

Kandinsky 2.1 — модель генерации изображений по тексту, разработанная Арсением Шахматовым, Антоном Разжигаевым, Александром Николичем, Игорем Павловым, Андреем Кузнецовым и Денисом Димитровым. Она предназначена для создания изображений по запросам, а также для редактирования и преобразования изображений под текстовым управлением и интерполяции между изображениями.

Модель сочетает подходы unCLIP и латентной диффузии: включает трансформерный image prior, диффузионную UNet и декодер MoVQGAN. CLIP-кодировщик преобразует текст и изображения в эмбеддинги; image prior связывает эти пространства, а диффузионная часть формирует изображение. Для обучения использовались данные LAION и дополнительные высококачественные изображения с описаниями. Модель доступна в формате Diffusers и поддерживает работу через библиотеку diffusers.

Репозиторий распространяется по лицензии Apache-2.0. Это генеративная модель, поэтому результат зависит от формулировки запроса и может не соответствовать ему точно; описание не приводит отдельных гарантий качества для конкретных сценариев.

Сценарии применения

  • создание иллюстраций по текстовому описанию
  • генерация изображений для концепт-арта
  • редактирование изображения по текстовой инструкции
  • интерполяция между изображениями

Ограничения

Результат зависит от формулировки текстового запроса и может не точно соответствовать ему. README не сообщает отдельных ограничений качества для конкретных сценариев.

Для каких профессий подходит4

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Kandinsky 2.1

Kandinsky 2.1 inherits best practices from Dall-E 2 and Latent diffusion while introducing some new ideas.

It uses the CLIP model as a text and image encoder, and diffusion image prior (mapping) between latent spaces of CLIP modalities. This approach increases the visual performance of the model and unveils new horizons in blending images and text-guided image manipulation.

The Kandinsky model is created by Arseniy Shakhmatov, Anton Razzhigaev, Aleksandr Nikolich, Igor Pavlov, Andrey Kuznetsov and Denis Dimitrov

Usage

Kandinsky 2.1 is available in diffusers!

pip install diffusers transformers accelerate

Text to image

from diffusers import AutoPipelineForText2Image
import torch

pipe = AutoPipelineForText2Image.from_pretrained("kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

prompt = "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting"
negative_prompt = "low quality, bad quality"

image = pipe(prompt=prompt, negative_prompt=negative_prompt, prior_guidance_scale =1.0, height=768, width=768).images[0]
image.save("cheeseburger_monster.png")

img

Text Guided Image-to-Image Generation

from diffusers import AutoPipelineForImage2Image
import torch
import requests
from io import BytesIO
from PIL import Image
import os

pipe = AutoPipelineForImage2Image.from_pretrained("kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16)

pipe.enable_model_cpu_offload()

prompt = "A fantasy landscape, Cinematic lighting"
negative_prompt = "low quality, bad quality"

url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
 
response = requests.get(url)
original_image = Image.open(BytesIO(response.content)).convert("RGB")
original_image.thumbnail((768, 768))

image = pipe(prompt=prompt, image=original_image, strength=0.3).images[0]
out.images[0].save("fantasy_land.png")

img

Interpolate

from diffusers import KandinskyPriorPipeline, KandinskyPipeline
from diffusers.utils import load_image
import PIL

import torch

pipe_prior = KandinskyPriorPipeline.from_pretrained(
    "kandinsky-community/kandinsky-2-1-prior", torch_dtype=torch.float16
)
pipe_prior.to("cuda")

img1 = load_image(
    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main" "/kandinsky/cat.png"
)

img2 = load_image(
    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main" "/kandinsky/starry_night.jpeg"
)

# add all the conditions we want to interpolate, can be either text or image
images_texts = ["a cat", img1, img2]

# specify the weights for each condition in images_texts
weights = [0.3, 0.3, 0.4]

# We can leave the prompt empty
prompt = ""
prior_out = pipe_prior.interpolate(images_texts, weights)

pipe = KandinskyPipeline.from_pretrained("kandinsky-community/kandinsky-2-1", torch_dtype=torch.float16)
pipe.to("cuda")

image = pipe(prompt, **prior_out, height=768, width=768).images[0]

image.save("starry_cat.png")

img

Model Architecture

Overview

Kandinsky 2.1 is a text-conditional diffusion model based on unCLIP and latent diffusion, composed of a transformer-based image prior model, a unet diffusion model, and a decoder.

The model architectures are illustrated in the figure below - the chart on the left describes the process to train the image prior model, the figure in the center is the text-to-image generation process, and the figure on the right is image interpolation.

Specifically, the image prior model was trained on CLIP text and image embeddings generated with a pre-trained mCLIP model. The trained image prior model is then used to generate mCLIP image embeddings for input text prompts. Both the input text prompts and its mCLIP image embeddings are used in the diffusion process. A MoVQGAN model acts as the final block of the model, which decodes the latent representation into an actual image.

Details

The image prior training of the model was performed on the LAION Improved Aesthetics dataset, and then fine-tuning was performed on the LAION HighRes data.

The main Text2Image diffusion model was trained on the basis of 170M text-image pairs from the LAION HighRes dataset (an important condition was the presence of images with a resolution of at least 768x768). The use of 170M pairs is due to the fact that we kept the UNet diffusion block from Kandinsky 2.0, which allowed us not to train it from scratch. Further, at the stage of fine-tuning, a dataset of 2M very high-quality high-resolution images with descriptions (COYO, anime, landmarks_russia, and a number of others) was used separately collected from open sources.

Evaluation

We quantitatively measure the performance of Kandinsky 2.1 on the COCO_30k dataset, in zero-shot mode. The table below presents FID.

FID metric values ​​for generative models on COCO_30k

FID (30k)
eDiff-I (2022)6.95
Image (2022)7.27
Kandinsky 2.1 (2023)8.21
Stable Diffusion 2.1 (2022)8.59
GigaGAN, 512x512 (2023)9.09
DALL-E 2 (2022)10.39
GLIDE (2022)12.24
Kandinsky 1.0 (2022)15.40
DALL-E (2021)17.89
Kandinsky 2.0 (2022)20.00
GLIGEN (2022)21.04

For more information, please refer to the upcoming technical report.

BibTex

If you find this repository useful in your research, please cite:

@misc{kandinsky 2.1,
  title         = {kandinsky 2.1},
  author        = {Arseniy Shakhmatov, Anton Razzhigaev, Aleksandr Nikolich, Vladimir Arkhipkin, Igor Pavlov, Andrey Kuznetsov, Denis Dimitrov},
  year          = {2023},
  howpublished  = {},
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Можно запустить

Подбираем GPU…

Ревизия весов
ceeafaf

0 моделей