TurboFillModel<T>

Models & Types · AiDotNet.Diffusion.ImageEditing

TurboFill model for fast few-step inpainting using adversarial distillation on SDXL.

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

For Beginners

Normal inpainting models need 20-50 steps, which can be slow. TurboFill has been specially trained to produce good results in just 4-8 steps, making it much faster — almost real-time for editing workflows.

How It Works

TurboFill achieves high-quality inpainting in just 4-8 denoising steps by applying adversarial distillation to an inpainting-finetuned SDXL model. This makes it suitable for interactive and real-time inpainting applications.

Technical specifications:

  • Base model: SDXL Inpainting (adversarially distilled)
  • Text encoders: CLIP ViT-L/14 + OpenCLIP ViT-G/14 (2048 context)
  • Input channels: 9 (4 latent + 4 masked image latent + 1 mask)
  • Typical steps: 4-8 (vs 20-50 for standard SDXL)
  • Guidance: Low (2.0) due to adversarial distillation
  • Resolution: 1024x1024 native

Example

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

Constructors

Constructor Summary
TurboFillModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<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()