sketchkit.sketch2image.pix2pix.Pix2PixModel¶
- class sketchkit.sketch2image.pix2pix.Pix2PixModel(device: str = 'cuda', model_name: str = 'diffusers/sdxl-instructpix2pix-768', vae_model: str = 'madebyollin/sdxl-vae-fp16-fix', torch_dtype: dtype = torch.float16, safety_checker: bool = False, **kwargs: Any)[source]¶
InstructPix2Pix model for direct sketch-to-image translation using SDXL.
- pipeline¶
The loaded diffusers pipeline.
- Type:
StableDiffusionXLInstructPix2PixPipeline
- model_name¶
The name/path of the loaded InstructPix2Pix model.
- Type:
str
- device¶
Computation device (‘cuda’ or ‘cpu’).
- Type:
str
- __init__(device: str = 'cuda', model_name: str = 'diffusers/sdxl-instructpix2pix-768', vae_model: str = 'madebyollin/sdxl-vae-fp16-fix', torch_dtype: dtype = torch.float16, safety_checker: bool = False, **kwargs: Any)[source]¶
Initializes the SDXL Pix2Pix model.
- Parameters:
device (str) – Hardware device to run the model on. Defaults to “cuda”.
model_name (str) – HuggingFace hub path for the InstructPix2Pix 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