Uh oh!
There was an error while loading. Please reload this page.
Fix: leaf_level offloading breaks after delete_adapters - #12639
Conversation
yiyixuxu
commented
Nov 12, 2025
thanks for the PR! @adi776borate |
sayakpaul
commented
Nov 13, 2025
@adi776borate thanks for your PR! Could you also add a test for this in https://github.com/huggingface/diffusers/blob/main/tests/lora/utils.py? @yiyixuxu we have a test for Line 2341 in 7a001c3 I ran it with ====================== 16 passed, 1 skipped, 860 deselected, 2 warnings in 60.04s (0:01:00) ======================So, @adi776borate maybe we could start by adding a similar test case as Line 2341 in 7a001c3 enable_sequential_cpu_offload() (can happen in a separate PR). |
adi776borate
commented
Nov 13, 2025
@sayakpaul I've added a regression test @yiyixuxu I also verified locally that Ready for the review. |
HuggingFaceDocBuilderDev
commented
Nov 13, 2025
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. |
| pipe.load_lora_weights(tmpdirname, adapter_name="default") | ||
| pipe(**inputs, generator=torch.manual_seed(0)) | ||
| # Delete the adapter | ||
| pipe.delete_adapters("default") |
There was a problem hiding this comment.
We can make this test tighter by also adding some assertions:
diff --git a/tests/lora/utils.py b/tests/lora/utils.py
index efe68dd3c..7e19aac29 100644
--- a/tests/lora/utils.py+++ b/tests/lora/utils.py@@ -2403,7 +2403,9 @@ class PeftLoraLoaderMixinTests:
)
pipe.load_lora_weights(tmpdirname, adapter_name="default")
- pipe(**inputs, generator=torch.manual_seed(0))+ out_lora = pipe(**inputs, generator=torch.manual_seed(0))[0]+
# Delete the adapter
pipe.delete_adapters("default")
- pipe(**inputs, generator=torch.manual_seed(0))
\ No newline at end of file
+ out_no_lora = pipe(**inputs, generator=torch.manual_seed(0))[0]+ self.assertFalse(np.allclose(out_lora, out_no_lora, atol=1e-3, rtol=1e-3))
\ No newline at end of file
There was a problem hiding this comment.
Thanks for the suggestion! I have made the changes.
adi776borate
commented
Nov 15, 2025
@yiyixuxu I'm getting familiar with testing and resolving CI errors. |
sayakpaul
commented
Nov 20, 2025
I have ran the tests and they are passing as well. Thanks for your work! |
sayakpaul
commented
Nov 29, 2025
songh11
commented
Dec 3, 2025
Sorry for being busy recently and not seeing this earlier—this solved my problem perfectly. Thank you! @adi776borate |
sayakpaul
commented
Dec 3, 2025
Failing tests are unrelated. |
Uh oh!
There was an error while loading. Please reload this page.
sayakpaul
commented
Dec 3, 2025
Thanks for your contributions, @adi776borate! |
adi776borate
commented
Dec 3, 2025
Thank you @sayakpaul and @yiyixuxu! I really appreciate the guidance. It's been a great experience, and I'm excited to have my first PR merged into 🧨. |
What does this PR do?
Fixes#12396
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@yiyixuxu
@sayakpaul
Anyone in the community is free to review the PR once the tests have passed.