sketchkit.sketch2image.t2i_adapter.T2IAdapterModel

class sketchkit.sketch2image.t2i_adapter.T2IAdapterModel(device: str = 'cuda', adapter_model: str = 'TencentARC/t2i-adapter-sketch-sdxl-1.0', sd_model: str = 'stabilityai/stable-diffusion-xl-base-1.0', vae_model: str = 'madebyollin/sdxl-vae-fp16-fix', torch_dtype: dtype = torch.float16, safety_checker: bool = False, **kwargs: Any)[source]

T2I-Adapter model for edge/sketch-conditioned sketch-to-image conversion using SDXL.

pipeline

The loaded diffusers pipeline.

Type:

StableDiffusionXLAdapterPipeline

adapter_model

The name/path of the loaded T2I-Adapter.

Type:

str

sd_model

The name/path of the base SDXL model.

Type:

str

device

Computation device (‘cuda’ or ‘cpu’).

Type:

str

__init__(device: str = 'cuda', adapter_model: str = 'TencentARC/t2i-adapter-sketch-sdxl-1.0', sd_model: str = 'stabilityai/stable-diffusion-xl-base-1.0', vae_model: str = 'madebyollin/sdxl-vae-fp16-fix', torch_dtype: dtype = torch.float16, safety_checker: bool = False, **kwargs: Any)[source]

Initializes the T2I-Adapter model with SDXL, VAE, and Euler Ancestral Scheduler.

Parameters:
  • device (str) – Hardware device to run the model on. Defaults to “cuda”.

  • adapter_model (str) – HuggingFace hub path for the T2I-Adapter.

  • sd_model (str) – HuggingFace hub path or local path for the base SDXL model.

  • vae_model (str) – HuggingFace hub path or local path for the VAE model.

  • torch_dtype (torch.dtype) – PyTorch data type for model weights.

  • safety_checker (bool) – Whether to enable the NSFW safety checker.

  • **kwargs (Any) – Additional kwargs passed to diffusers loading methods.

Raises:
  • ImportError – If required diffusers library versions are missing.

  • RuntimeError – If model initialization fails.

Methods

__init__([device, adapter_model, sd_model, ...])

Initializes the T2I-Adapter model with SDXL, VAE, and Euler Ancestral Scheduler.

generate(control_image, prompt[, size, ...])

Generates an image from an edge or sketch conditioned image using SDXL T2I-Adapter.