The denoising network: latent patches in, noise prediction out.
Parameters
configDiTConfigThe variant to build.
Attributes
patch_embedlucid.nn.Conv2dPatchifying projection — stride equals kernel, so patches do not
overlap.
pos_embedTensorFrozen sine-cosine table, registered as a buffer.
blockslucid.nn.ModuleListThe transformer blocks, of whichever kind the conditioning names.
finalDiTFinalLayerModulated norm and the projection back to patch space.
Notes
Reference: Peebles and Xie, "Scalable Diffusion Models with Transformers", ICCV, 2023 (arXiv:2212.09748). Backbone shapes are Table 1.
Examples
>>> import lucid
>>> from lucid.models.generative.dit import DiTConfig, DiTModel
>>> config = DiTConfig(sample_size=8, patch_size=2, hidden_size=32,
... depth=2, num_heads=4, num_classes=10)
>>> model = DiTModel(config).eval()
>>> latent = lucid.randn((1, 4, 8, 8))
>>> model(latent, lucid.tensor([10.0]), lucid.tensor([3], dtype=lucid.int64)).shape
(1, 8, 8, 8)Used by 2
Constructors
1Instance methods
1Predict the noise (and covariance) in a noised latent.
Parameters
Returns
Tensor(B, out_channels, H, W) — noise, and the covariance
beside it when learn_sigma.