sketchkit.sketch2image.controlnet.ControlNetModel¶
- class sketchkit.sketch2image.controlnet.ControlNetModel(device: str = 'cuda', controlnet_model: str = 'xinsir/controlnet-scribble-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]¶
ControlNet model for scribble-conditioned sketch-to-image conversion using SDXL.
- pipeline¶
The loaded diffusers pipeline.
- Type:
StableDiffusionXLControlNetPipeline
- controlnet_model¶
The name/path of the loaded ControlNet.
- 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', controlnet_model: str = 'xinsir/controlnet-scribble-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 ControlNet model with SDXL, VAE, and Euler Ancestral Scheduler.
- Parameters:
device (str) – Hardware device to run the model on. Defaults to “cuda”.
controlnet_model (str) – HuggingFace hub path or local path for the ControlNet.
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