SD3-Controlnet-Tile / README.md
wangqixun's picture
Update README.md
3f8b4ba verified
|
raw
history blame
No virus
1.81 kB

SD3 Controlnet

| control image | weight=0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 | |:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:| | | | | | | | |

Install Diffusers-SD3-Controlnet

The current diffusers have not been merged into the official code yet.

git clone -b sd3_control https://github.com/instantX-research/diffusers_sd3_control.git
cd diffusers_sd3_control
pip install -e .

Demo

import torch
from diffusers import StableDiffusion3ControlNetPipeline
from diffusers.models import SD3ControlNetModel, SD3MultiControlNetModel
from diffusers.utils import load_image

# load pipeline
controlnet = SD3ControlNetModel.from_pretrained("InstantX/SD3-Controlnet-Tile")
pipe = StableDiffusion3ControlNetPipeline.from_pretrained(
    "stabilityai/stable-diffusion-3-medium-diffusers",
    controlnet=controlnet
)
pipe.to("cuda", torch.float16)

# config
control_image = load_image("https://huggingface.co/InstantX/SD3-Controlnet-Tile/resolve/main/tile.jpg")
prompt = 'Anime style illustration of a girl wearing a suit. A moon in sky. In the background we see a big rain approaching. text "InstantX" on image'
n_prompt = 'NSFW, nude, naked, porn, ugly'
image = pipe(
    prompt, 
    negative_prompt=n_prompt, 
    control_image=tile_image, 
    controlnet_conditioning_scale=0.5,
).images[0]
image.save('image.jpg')