azula.plugins.flux¶
Flux plugin.
This plugin depends on diffusers and transformers. To use it,
install the dependencies in your environment
pip install diffusers transformers accelerate protobuf sentencepiece
before importing the plugin.
from azula.plugins import flux
References
Classes¶
Creates an auto-encoder wrapper. |
|
Creates a text encoder. |
|
Creates a Flux denoiser. |
Functions¶
Loads a pre-trained Flux latent denoiser. |
Descriptions¶
- class azula.plugins.flux.AutoEncoder(vae, shift=0.0, scale=1.0)¶[source]
Creates an auto-encoder wrapper.
- class azula.plugins.flux.TextEncoder(clip, clip_tokenizer, t5, t5_tokenizer)¶[source]
Creates a text encoder.
- class azula.plugins.flux.FluxDenoiser(backbone, schedule=None)¶[source]
Creates a Flux denoiser.
- Parameters:
backbone (Module) – A time conditional network.
schedule (Schedule) – A noise schedule. If
None, useazula.noise.DecayScheduleinstead.
- forward(z_t, t, prompt_clip, prompt_t5, guidance=4.0, **kwargs)¶[source]
- Parameters:
z_t (Tensor) – A noisy tensor \(z_t\), with shape \((B, H, W, 64)\).
t (Tensor) – The time \(t\), with shape \(()\) or \((B)\).
prompt_clip (Tensor) – The CLIP-encoded text prompt \(y\), with shape \((B, F)\).
prompt_t5 (Tensor) – The T5-encoded text prompt \(y\), with shape \((B, L, D)\).
guidance (float | Tensor) – The guidance strength \(\omega \in \mathbb{R}\).
kwargs – Optional keyword arguments.
- Returns:
The Dirac delta \(\delta(Z - \mu_\phi(z_t \mid y))\).
- Return type:
- azula.plugins.flux.load_model(name='flux_1_dev', **kwargs)¶[source]
Loads a pre-trained Flux latent denoiser.
- Parameters:
name (str) – The pre-trained model name.
kwargs – Keyword arguments passed to
diffusers.FluxPipeline.from_pretrained.
- Returns:
A pre-trained latent denoiser and the corresponding auto-encoder and text encoder.
- Return type: