InstantX 是一家专注于人工智能内容生成的独立研究机构。此前,曾开源著名的InstantID和论文《InstantID : Zero-shot Identity-Preserving Generation in Seconds》。随着本月12号,Stability AI正式开源了其产品 Stable Diffusion 3,这家机构又为SD的死忠粉带来了三款SD3专属的ControlNet工具——SD3-Controlnet-Pose、SD3-Controlnet-Canny 和 SD3-Controlnet-Tile。
SD3-Controlnet-Pose
control image | weight=0.0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 |
---|---|---|---|---|---|
请确认版本diffusers >= 0.30.0.dev0
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-Pose")
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-Pose/resolve/main/pose.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=control_image,
controlnet_conditioning_scale=0.5,
).images[0]
image.save('image.jpg')
SD3-Controlnet-Canny
control image | weight=0.0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 |
---|---|---|---|---|---|
请确认版本diffusers >= 0.30.0.dev0
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-Canny")
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-Canny/resolve/main/canny.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=control_image,
controlnet_conditioning_scale=0.5,
).images[0]
image.save('image.jpg')
SD3-Controlnet-Tile
control image | weight=0.0 | weight=0.3 | weight=0.5 | weight=0.7 | weight=0.9 |
---|---|---|---|---|---|
请确认版本diffusers >= 0.30.0.dev0
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=control_image,
controlnet_conditioning_scale=0.5,
).images[0]
image.save('image.jpg')
感谢大家花时间阅读我的文章,你们的支持是我不断前进的动力。期待未来能为大家带来更多有价值的内容,请多多关注我的动态!