EDiffIModel<T>

Models & Types · AiDotNet.Diffusion.TextToImage

eDiff-I model — ensemble of expert denoisers for text-to-image diffusion.

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

For Beginners

eDiff-I uses teamwork among specialist networks:

How eDiff-I works:

  1. Multiple specialized U-Nets are trained for different noise levels
  2. High-noise expert: generates overall structure and composition
  3. Mid-noise expert: adds medium-scale features and objects
  4. Low-noise expert: refines fine details and textures
  5. The right expert is used at each denoising step

Key characteristics:

  • Ensemble of 3+ specialized denoiser networks
  • Each expert trained on specific noise range
  • Better quality than single-model approaches
  • Paint-with-words: spatial control over generation

Use eDiff-I when you need:

  • Maximum image quality
  • Spatial control over concept placement
  • Better structure-detail trade-off

How It Works

eDiff-I uses an ensemble of specialized denoiser networks, each trained on a specific range of noise levels. This allows each expert to focus on generating specific aspects: structure (high noise) vs detail (low noise).

Technical specifications:

  • Architecture: Ensemble of U-Nets with noise-level specialization
  • Experts: 3 specialized denoisers (high/mid/low noise)
  • Text encoder: T5-XXL + CLIP ensemble
  • Resolution: 256x256 base, cascaded to 1024x1024
  • Paint-with-words: region-based text-to-image control

Reference: Balaji et al., “eDiff-I: Text-to-Image Diffusion Models with an Ensemble of Expert Denoisers”, 2022

Example

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

Constructors

Constructor Summary
EDiffIModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> unet, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) Initializes a new instance of EDiffIModel with full customization support.

Properties

Property Summary
IConditioningModule<T> Conditioner { get; }
INoisePredictor<T> NoisePredictor { get; }
IVAEModel<T> VAE { get; }
int LatentChannels { get; }
int NumExperts { get; } Gets the number of expert denoisers in the ensemble.

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()
Tensor<T> GenerateFromText(string prompt, string negativePrompt, int width, int height, int numInferenceSteps, double? guidanceScale, int? seed)

Fields

Field Summary
int DefaultHeight
int DefaultWidth