ControlNetSD3Model<T>

Models & Types · AiDotNet.Diffusion.Control

ControlNet adapted for Stable Diffusion 3’s MMDiT architecture.

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

For Beginners

This brings ControlNet control to Stable Diffusion 3 models. SD3 uses a completely different architecture from SD1.5/SDXL, so this version is specially designed to inject control signals into the transformer blocks.

How It Works

Adapts ControlNet conditioning for SD3’s Multi-Modal Diffusion Transformer (MMDiT) architecture. Uses 16-channel latent space and supports dual text encoders (CLIP + T5) for enhanced prompt understanding with control signal injection.

Example

// Create a ControlNet for Stable Diffusion 3
var options = new DiffusionModelOptions<float>
{
    LatentChannels = 16,
    DefaultInferenceSteps = 28
};
            
// Generate with control on SD3's MMDiT architecture
var controlImage = Tensor<float>.CreateRandom(new[] { 1, 1, 1024, 1024 });
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 ControlNetSD3Model<float>(options: options, controlType: ControlType.Canny))
    .Build(trainX, trainY);
var prediction = result.Predict(controlImage);

Constructors

Constructor Summary
ControlNetSD3Model(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, MMDiTXNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, ControlType controlType, int? seed) Initializes a new ControlNet-SD3 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()