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.pidi import PidiNetDetector
4import torch
5
6# load adapter
7adapter = T2IAdapter.from_pretrained(
8 "TencentARC/t2i-adapter-sketch-sdxl-1.0", torch_dtype=torch.float16, varient="fp16"
9).to("cuda")
10
11# load euler_a scheduler
12model_id = 'stabilityai/stable-diffusion-xl-base-1.0'
13euler_a = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
14vae=AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
15pipe = StableDiffusionXLAdapterPipeline.from_pretrained(
16 model_id, vae=vae, adapter=adapter, scheduler=euler_a, torch_dtype=torch.float16, variant="fp16",
17).to("cuda")
18pipe.enable_xformers_memory_efficient_attention()
19
20pidinet = PidiNetDetector.from_pretrained("lllyasviel/Annotators").to("cuda")1url = "https://huggingface.co/Adapter/t2iadapter/resolve/main/figs_SDXLV1.0/org_sketch.png"
2image = load_image(url)
3image = pidinet(
4 image, detect_resolution=1024, image_resolution=1024, apply_filter=True
5)1prompt = "a robot, mount fuji in the background, 4k photo, highly detailed"
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 adapter_conditioning_scale=0.9,
10 guidance_scale=7.5,
11).images[0]
12gen_images.save('out_sketch.png')16 for a total batch size of 256.1e-5.