-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Adding eg "qk_norm": "rms_norm"
to config.json for a UNet2DConditionModel
has no effect.
This is because the value is not propagated by the UNet2DContionalModel
initialization logic through to Attention.__init__
in src/diffusers/models/attention_processor.py
.
Reproduction
Default behaviour with empty config dict:
from diffusers import UNet2DConditionModel
config_minimal = {}
model = UNet2DConditionModel.from_config(config_minimal)
print([n for n, _ in model.named_modules()
if 'attn1.norm_' in n])
# output: []
For supported models, QK norm modules show up as eg ... .attn1.norm_q
and ... .attn1.norm_k
. If we add "qk_norm" : "rms_norm"
to the config then we should expect modules with these names to appear, but they don't:
config_minimal['qk_norm'] = 'rms_norm'
model = UNet2DConditionModel.from_config(config_minimal)
print([n for n, _ in model.named_modules()
if 'attn1.norm_' in n])
# expected output: ['down_blocks.0.attentions.0.transformer_blocks.0.attn1.norm_q', 'down_blocks.0.attentions.0.transformer_blocks.0.attn1.norm_k', ...]
# actual output: []
System Info
diffusers main branch commit 0c71189, macOS
Who can help?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working