PixArtSigmaModel<T>
Models & Types · AiDotNet.Diffusion.TextToImage
PixArt-Sigma model for high-resolution text-to-image generation with improved quality.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → PixArtSigmaModel<T>
For Beginners
PixArt-Sigma is an upgraded version of PixArt-Alpha:
Key improvements over PixArt-Alpha:
- Higher native resolution: supports up to 4096x4096
- Better image quality from improved training data
- Flexible aspect ratios via bucket training
- Still very efficient (DiT-based, much faster than U-Net models)
How PixArt-Sigma works:
- Text goes through T5-XXL encoder (4096-dim)
- DiT transformer blocks denoise the latent with cross-attention to text
- Trained on high-quality curated datasets with better captions
- VAE decodes to final high-resolution image
Use PixArt-Sigma when you need:
- High-resolution output (up to 4K)
- Fast generation on limited hardware
- Good quality with flexible aspect ratios
How It Works
PixArt-Sigma is the successor to PixArt-Alpha, featuring improved training data quality, higher native resolution support (up to 4K), and better aesthetic quality. It maintains the efficient DiT architecture while achieving quality comparable to SDXL and DALL-E 3.
Technical specifications:
- Architecture: DiT (Diffusion Transformer) with T5-XXL text encoder
- Parameters: ~600M (DiT-XL/2)
- Text encoder: T5-XXL (4096-dim embeddings)
- Native resolution: up to 4096x4096
- Latent space: 4 channels, 8x downsampling
- Scheduler: DPM-Solver with 20 steps recommended
Reference: Chen et al., “PixArt-Sigma: Weak-to-Strong Training of Diffusion Transformer for 4K Text-to-Image Generation”, ECCV 2024
Example
var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 20 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 4, 256, 256 });
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 PixArtSigmaModel<float>(options: options))
.Build(trainX, trainY);
var generated = result.Predict(noise);
Constructors
| Constructor | Summary |
|---|---|
PixArtSigmaModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, DiTNoisePredictor<T> dit, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Initializes a new instance of PixArtSigmaModel with full customization support. |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
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 |