Views
No views yet
| Model Name | Control Image Overview | Control Image Example | Generated Image Example |
|---|---|---|---|
| TencentARC/t2i-adapter-canny-sdxl-1.0 Trained with canny edge detection | A monochrome image with white edges on a black background. | ![]() | ![]() |
| TencentARC/t2i-adapter-sketch-sdxl-1.0 Trained with PidiNet edge detection | A hand-drawn monochrome image with white outlines on a black background. | ![]() | ![]() |
| TencentARC/t2i-adapter-lineart-sdxl-1.0 Trained with lineart edge detection | A hand-drawn monochrome image with white outlines on a black background. | ![]() | ![]() |
| TencentARC/t2i-adapter-depth-midas-sdxl-1.0 Trained with Midas depth estimation | A grayscale image with black representing deep areas and white representing shallow areas. | ![]() | ![]() |
| TencentARC/t2i-adapter-depth-zoe-sdxl-1.0 Trained with Zoe depth estimation | A grayscale image with black representing deep areas and white representing shallow areas. | ![]() | ![]() |
| TencentARC/t2i-adapter-openpose-sdxl-1.0 Trained with OpenPose bone image | A OpenPose bone image. | ![]() | ![]() |
1pip install -U git+https://github.com/huggingface/diffusers.git
2pip install -U controlnet_aux==0.0.7 # for conditioning models and detectors
3pip install transformers accelerate safetensorsStableDiffusionXLAdapterPipeline.1from diffusers import StableDiffusionXLAdapterPipeline, T2IAdapter, EulerAncestralDiscreteScheduler, AutoencoderKL
2from diffusers.utils import load_image, make_image_grid
3from controlnet_aux.canny import CannyDetector
4import torch
5
6# load adapter
7adapter = T2IAdapter.from_pretrained("TencentARC/t2i-adapter-canny-sdxl-1.0", torch_dtype=torch.float16, varient="fp16").to("cuda")
8
9# load euler_a scheduler
10model_id = 'stabilityai/stable-diffusion-xl-base-1.0'
11euler_a = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
12vae=AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
13pipe = StableDiffusionXLAdapterPipeline.from_pretrained(
14 model_id, vae=vae, adapter=adapter, scheduler=euler_a, torch_dtype=torch.float16, variant="fp16",
15).to("cuda")
16pipe.enable_xformers_memory_efficient_attention()
17
18canny_detector = CannyDetector()1url = "https://huggingface.co/Adapter/t2iadapter/resolve/main/figs_SDXLV1.0/org_canny.jpg"
2image = load_image(url)
3
4# Detect the canny map in low resolution to avoid high-frequency details
5image = canny_detector(image, detect_resolution=384, image_resolution=1024)#.resize((1024, 1024))1prompt = "Mystical fairy in real, magic, 4k picture, high quality"
2negative_prompt = "extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured"
3
4gen_images = pipe(
5 prompt=prompt,
6 negative_prompt=negative_prompt,
7 image=image,
8 num_inference_steps=30,
9 guidance_scale=7.5,
10 adapter_conditioning_scale=0.8,
11 adapter_conditioning_factor=1
12).images[0]
13gen_images.save('out_canny.png')16 for a total batch size of 256.1e-5.