SDXLTurboModel
Distilled SDXL model for near-real-time text-to-image generation.
Wraps stabilityai/sdxl-turbo, a version of Stable Diffusion XL
trained with Adversarial Diffusion Distillation (ADD) by Stability AI.
ADD transfers knowledge from a large teacher model into a student that
can produce photorealistic 512 px images in as few as one denoising step,
up to 30x faster than standard SDXL.
Because ADD bakes guidance directly into the model weights, classifier-free
guidance is disabled (guidance_scale=0 is enforced internally) and
negative prompts have minimal effect.
Ideal for interactive and real-time applications where latency matters more than absolute peak quality.
References
- [1] Sauer et al., "Adversarial Diffusion Distillation", 2023. https://arxiv.org/abs/2311.17042
- [2] https://huggingface.co/stabilityai/sdxl-turbo
Parameters
- negative_prompt
- num_inference_steps : integer, default=
1 - Number of denoising steps. SDXL Turbo is a distilled model that generates high-quality images in just 1-4 steps. Using 1 step is fastest; 2-4 steps improve quality slightly. Values above 4 provide diminishing returns for this model.
- device : string, default=
CPU - Hardware device for inference. SDXL Turbo is fast enough that CPU inference is feasible (30-60 seconds per image). GPU is still recommended for real-time or batch generation.
- seed : integer, default=
-1 - Random seed for reproducible generation. A fixed positive integer will always produce the same image for identical settings. Use a negative value (e.g. -1) for a random seed on each run.
- width : integer, default=
512 - Width of the output image in pixels. Must be a multiple of 8. SDXL Turbo's optimal resolution is 512x512 px. Larger resolutions may reduce quality as the model was trained at 512 px.
- height : integer, default=
512 - Height of the output image in pixels. Must be a multiple of 8. SDXL Turbo's optimal resolution is 512x512 px.
- num_images_per_prompt : integer, default=
1 - How many images to generate from a single prompt in one batch. Since SDXL Turbo is fast, generating multiple images per prompt is very efficient.
Methods
generate(self, input: str) -> List[Any]
SDXLTurboModelGenerate images from a text prompt using single-step distillation.
Parameters
- input : str
- Text prompt to generate an image from.
Returns
- List[Any]
- Generated output images in a list.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.