SDXLTurboModel<T>
Models & Types · AiDotNet.Diffusion.FastGeneration
SDXL Turbo model for real-time single-step high-resolution image generation.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → SDXLTurboModel<T>
For Beginners
SDXL Turbo combines the image quality of SDXL (one of the best open-source models) with near-instant generation. While regular SDXL needs 25-50 steps, SDXL Turbo generates comparable images in just 1 step. No guidance needed (scale=0).
How It Works
SDXL Turbo is the SDXL-based variant of Adversarial Diffusion Distillation (ADD), generating 512x512 images in 1-4 steps with SDXL-quality aesthetics. Uses the full SDXL U-Net with dual text encoder conditioning (CLIP ViT-L + OpenCLIP ViT-bigG).
Reference: Sauer et al., “Adversarial Diffusion Distillation”, 2023
Example
var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 1 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 4, 64, 64 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new SDXLTurboModel<float>(options: options))
.Build(trainX, trainY);
var generated = result.Predict(noise);
Constructors
| Constructor | Summary |
|---|---|
SDXLTurboModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Initializes a new SDXL Turbo model. |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |