azula.plugins.eldm¶
Elucidated latent diffusion model (ELDM or EDM2) plugin.
This plugin depends on the torch_utils and training modules in the NVlabs/edm2 repository. To use it, clone the repository to your
machine
git clone https://github.com/NVlabs/edm2
and add it to your Python path before importing the plugin.
import sys; sys.path.append("path/to/edm2")
...
from azula.plugins import eldm
You may also need to install additional dependencies, including diffusers and
accelerate.
pip install diffusers accelerate
References
Classes¶
Creates a standardized auto-encoder. |
|
Creates an elucidated latent denoiser. |
Functions¶
Returns a key-card mapping of available pre-trained models. |
|
Loads a pre-trained ELDM (or EDM2) latent denoiser. |
Descriptions¶
- class azula.plugins.eldm.AutoEncoder(vae, shift, scale)¶
Creates a standardized auto-encoder.
- Parameters:
- encode(x)¶
Encodes images to latents.
- class azula.plugins.eldm.ElucidatedLatentDenoiser(backbone, schedule=None)¶
Creates an elucidated latent denoiser.
\[\begin{split}\mu_\phi(x_t \mid c) & = (1 - \omega) \, b_\phi(x_t, \sigma_t) + \omega \, b_\phi(x_t, \sigma_t \mid c) \\ \sigma^2_\phi(x_t \mid c) & = \frac{\sigma_t^2}{1 + \sigma_t^2}\end{split}\]where \(\omega \in \mathbb{R}_+\) is the classifier-free guidance strength.
- Parameters:
backbone (Module) – A noise conditional network \(b_\phi(x_t, \sigma_t \mid c)\).
schedule (Schedule) – A noise schedule. If
None, useazula.plugins.edm.ElucidatedScheduleinstead.
- forward(x_t, t, label=None, omega=None, **kwargs)¶
- Parameters:
x_t (Tensor) – A noisy tensor \(x_t\), with shape \((*, S)\).
t (Tensor) – The time \(t\), with shape \((*)\).
label (Tensor | None) – The class label \(c\) as a one-hot vector.
omega (Tensor | None) – The classifier-free guidance strength \(\omega \in \mathbb{R}\). If
None, classifier-free guidance is not applied.kwargs – Optional keyword arguments.
- Returns:
The Gaussian \(\mathcal{N}(X \mid \mu_\phi(x_t \mid c), \Sigma_\phi(x_t \mid c))\).
- Return type:
- azula.plugins.eldm.model_cards()¶
Returns a key-card mapping of available pre-trained models.