/ Модель

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

Лицензия
OpenRAIL++
Базовая модель
stable-diffusion-xl-base-1.0
Опубликована
15 авг 2023

controlnet-canny-sdxl-1.0-small

Генерация изображений3 профессии

diffusers/controlnet-canny-sdxl-1.0-small — экспериментальная компактная модель ControlNet из экосистемы Hugging Face Diffusers, обученная для совместной работы с Stable Diffusion XL base 1.0.

2 614скачиваний за 30 дней23лайкавеса обновлены16 авг 2023

Бенчмарки

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

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

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

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

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

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

Она управляет генерацией изображений по карте контуров Canny, сохраняя заданную структуру исходного изображения и позволяя получать изображения по текстовому описанию. Модель предназначена для сценариев text-to-image с контролем композиции, формы и границ объектов, включая фотореалистичные и художественные изображения.

Контрольная сеть примерно в семь раз меньше исходной версии XL ControlNet. Она не содержит attention-блоков и не использует distillation; компактная архитектура инициализирована из SDXL UNet. Модель работает с изображениями и текстом, поддерживается StableDiffusionXLControlNetPipeline и рассчитана на использование в FP16. В README не указаны точный размер в параметрах, максимальная длина контекста или перечень поддерживаемых языков. Для управления силой влияния контуров рекомендуется настраивать controlnet_conditioning_scale; значение 0,5 указано как подходящее для хорошей обобщающей способности.

Сильная сторона модели — существенно меньший размер при приемлемой работе с большинством изображений-контролей, что может упростить использование по сравнению с крупной версией ControlNet. Ограничения связаны с экспериментальным статусом: для сложных условий более крупные контрольные точки могут давать лучшее качество, а модель всё ещё требует улучшений. Лицензия указана как OpenRAIL++.

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

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

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

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

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

Открыть на Hugging Face

Small SDXL-controlnet: Canny

These are small controlnet weights trained on stabilityai/stable-diffusion-xl-base-1.0 with canny conditioning. This checkpoint is 7x smaller than the original XL controlnet checkpoint. You can find some example images in the following.

prompt: aerial view, a futuristic research complex in a bright foggy jungle, hard lighting images_0)

prompt: a woman, close up, detailed, beautiful, street photography, photorealistic, detailed, Kodak ektar 100, natural, candid shot images_1)

prompt: megatron in an apocalyptic world ground, runied city in the background, photorealistic images_2)

prompt: a couple watching sunset, 4k photo images_3)

Usage

Make sure to first install the libraries:

pip install accelerate transformers safetensors opencv-python diffusers

And then we're ready to go:

from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
from diffusers.utils import load_image
from PIL import Image
import torch
import numpy as np
import cv2

prompt = "aerial view, a futuristic research complex in a bright foggy jungle, hard lighting"
negative_prompt = "low quality, bad quality, sketches"

image = load_image("https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/hf-logo.png")

controlnet_conditioning_scale = 0.5  # recommended for good generalization

controlnet = ControlNetModel.from_pretrained(
    "diffusers/controlnet-canny-sdxl-1.0-small",
    torch_dtype=torch.float16
)
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
    "stabilityai/stable-diffusion-xl-base-1.0",
    controlnet=controlnet,
    vae=vae,
    torch_dtype=torch.float16,
)
pipe.enable_model_cpu_offload()

image = np.array(image)
image = cv2.Canny(image, 100, 200)
image = image[:, :, None]
image = np.concatenate([image, image, image], axis=2)
image = Image.fromarray(image)

images = pipe(
    prompt, negative_prompt=negative_prompt, image=image, controlnet_conditioning_scale=controlnet_conditioning_scale,
).images

images[0].save(f"hug_lab.png")

hug_lab_grid)

To more details, check out the official documentation of StableDiffusionXLControlNetPipeline.

🚨 Please note that this checkpoint is experimental and there's a lot of room for improvement. We encourage the community to build on top of it, improve it, and provide us with feedback. 🚨

Training

Our training script was built on top of the official training script that we provide here. You can refer to this script for full discolsure.

  • This checkpoint does not perform distillation. We just use a smaller ControlNet initialized from the SDXL UNet. We encourage the community to try and conduct distillation too. This resource might be of help in this regard.
  • To learn more about how the ControlNet was initialized, refer to this code block.
  • It does not have any attention blocks.
  • The model works pretty good on most conditioning images. But for more complex conditionings, the bigger checkpoints might be better. We are still working on improving the quality of this checkpoint and looking for feedback from the community.
  • We recommend playing around with the controlnet_conditioning_scale and guidance_scale arguments for potentially better image generation quality.

Training data

The model was trained on 3M images from LAION aesthetic 6 plus subset, with batch size of 256 for 50k steps with constant learning rate of 3e-5.

Compute

One 8xA100 machine

Mixed precision

FP16

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

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

GPU в ailist

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

Нельзя запустить

ControlNetModel управляет генерацией по входной картинке (поза, глубина, контуры): такой ввод пока не поддерживается.

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

0 моделей