ControlNetLiteModel<T>
Models & Types · AiDotNet.Diffusion.Control
Lightweight ControlNet model with reduced parameter count for faster inference.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → ControlNetLiteModel<T>
For Beginners
This is a smaller, faster version of ControlNet. It uses fewer parameters so it runs quicker and uses less memory, at the cost of slightly less precise control signal adherence.
How It Works
ControlNet Lite reduces the encoder to approximately 25% of the full ControlNet’s parameters while maintaining acceptable control quality. Suitable for real-time or resource-constrained applications.
Example
// Create a lightweight ControlNet for fast inference
var options = new DiffusionModelOptions<float>
{
LatentChannels = 4,
DefaultInferenceSteps = 15
};
// Generate with lightweight depth-guided control
var depthMap = Tensor<float>.CreateRandom(new[] { 1, 1, 512, 512 });
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 ControlNetLiteModel<float>(options: options, controlType: ControlType.Depth))
.Build(trainX, trainY);
var prediction = result.Predict(depthMap);
Constructors
| Constructor | Summary |
|---|---|
ControlNetLiteModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> baseUNet, StandardVAE<T> vae, IConditioningModule<T> conditioner, ControlType controlType, int? seed) |
Initializes a new ControlNet Lite 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() |