SD3TurboModel<T>

Models & Types · AiDotNet.Diffusion.FastGeneration

SD3 Turbo for few-step generation from Stable Diffusion 3 via distillation.

Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → SD3TurboModel<T>

For Beginners

SD3 uses a powerful new architecture (MMDiT) that produces excellent text rendering and composition. SD3 Turbo makes it 5-10x faster by distilling it to just 4-8 steps while keeping the same high quality.

How It Works

Distills the SD3 MMDiT architecture into a 4-8 step generator while preserving the benefits of the triple text encoder (CLIP L, CLIP G, T5-XXL) conditioning. Uses flow-matching-aware distillation adapted for the rectified flow formulation.

Example

var options = new DiffusionModelOptions<float> { LatentChannels = 16, DefaultInferenceSteps = 4 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 16, 128, 128 });
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 SD3TurboModel<float>(options: options))
    .Build(trainX, trainY);
var generated = result.Predict(noise);

Constructors

Constructor Summary
SD3TurboModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, MMDiTXNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed)

Properties

Property Summary
IConditioningModule<T> Conditioner { get; }
INoisePredictor<T> NoisePredictor { get; }
IVAEModel<T> VAE { get; }
int LatentChannels { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()