TurboEditModel<T>

Models & Types · AiDotNet.Diffusion.ImageEditing

TurboEdit model for fast few-step image editing using distilled SDXL Turbo.

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

For Beginners

TurboEdit is fast image editing — it can modify images in just 3-5 denoising steps, making it nearly instant. Great for interactive editing workflows where you want to see changes in real time.

How It Works

TurboEdit adapts DDPM inversion techniques to work with few-step distilled models (SDXL Turbo), enabling real-time image editing in just 3-5 steps. Uses carefully calibrated noise injection to maintain edit quality at low step counts.

Technical specifications:

  • Base model: SDXL Turbo (adversarially distilled)
  • Text encoders: CLIP ViT-L/14 + OpenCLIP ViT-G/14 (2048 context)
  • Editing: Adapted DDPM inversion for few-step regime
  • Typical steps: 3-5 (vs 20-50 for standard models)
  • Input channels: 8 (4 latent + 4 source image latent)
  • Guidance: Low (2.0) due to distillation

Reference: Deutch et al., “TurboEdit: Text-Based Image Editing Using Few-Step Diffusion Models”, 2024

Example

var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 4 };
var input = 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 TurboEditModel<float>(options: options))
    .Build(trainX, trainY);
var edited = result.Predict(input);

Constructors

Constructor Summary
TurboEditModel(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()