Replies: 1 comment
|
Confirmed from source (src/diffusers/models/normalization.py, https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/normalization.py): python So num_embeddings is not "better vs worse", it toggles whether the module owns its own CombinedTimestepLabelEmbeddings (timestep sinusoidal embed + class-label embed + MLP) or expects a precomputed emb tensor from outside. Where each pattern is actually used:
Facts vs hypothesis on "which is better": Confirmed:
Hypothesis (no evidence found):
Practical recommendation: unless you specifically need to reproduce/finetune from DiTTransformer2DModel's existing checkpoint format, prefer the shared-embedding pattern (num_embeddings=None, compute emb once, pass it into every AdaLayerNormZero.forward(..., emb=emb)), as used by Flux/SD3 — it is both the architecturally faithful choice and cheaper. There is no published evidence in this repo that per-block embedding weights improve model quality; if you find or run such an ablation, that would need to be validated separately. |
Uh oh!
There was an error while loading. Please reload this page.
I had read the code of
class AdaLayerNormZero, it seems there are two ways to use this module on timestep_embedding, One way is the emb will be a value from outside this module, Another way, is to set thenum_embeddingsinitial param to make thisAdaLayerNormZeromodule to keep its time_embedding layer weights.The first way will save time_embedding weights (in the
self.emb=CombinedTimestepLableEmbeddings), to let all DiT AdaLayerNormZero blocks share a single set of time_embedding weights; While the second way makes each AdaLayerNormZero keep independent time_embedding weights.The second way is more costly, but will it make better performance at the whole model?
All reactions