Uh oh!
There was an error while loading. Please reload this page.
Fix mutable default args in lora_base.py - #14064
Conversation
sayakpaul
left a comment
There was a problem hiding this comment.
Thanks! Do we have an example reproducer reflecting the issue that this PR attempts to solve?
HuggingFaceDocBuilderDev
commented
Jun 25, 2026
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
PrakshaaleJain
commented
Jun 25, 2026
Hi @sayakpaul! Although We can reproduce this directly on the live importinspectfromdiffusers.loaders.lora_baseimportLoraBaseMixinsig=inspect.signature(LoraBaseMixin.fuse_lora)
default_object=sig.parameters["components"].defaultprint(f"Initial default type: {type(default_object)}") # Expected: <class 'list'>default_object.append("leaked_state_or_component")
new_sig=inspect.signature(LoraBaseMixin.fuse_lora)
print(f"Mutated default value: {new_sig.parameters['components'].default}") # Expected: ['leaked_state_or_component']assertlen(new_sig.parameters["components"].default) >0, "Global signature state polluted!" |
Hi @PrakshaaleJain, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. |
PrakshaaleJain
commented
Jul 2, 2026
Hi @sayakpaul, can you help me in merging this change? |
Uh oh!
There was an error while loading. Please reload this page.
PrakshaaleJain
commented
Jul 2, 2026
Thanks!! @sayakpaul |
What does this PR do?
Fixes#14052
This PR fixes a bug in
src/diffusers/loaders/lora_base.pywhere a mutable default argument (components: list[str] = []) was used in the signatures offuse_loraandunfuse_lora. It updates the default value toNoneand initializes it as a clean, empty list inside the method body if no explicit argument is passed.Why this change is important:
Before submitting
.ai/review-rules.md?documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Core library / PEFT integrations: