diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[LoRA] make `set_adapters()` robust on silent failures.

Open sayakpaul opened this issue 1 year ago • 4 comments

What does this PR do?

Currently, if we do

scales = {"text_encoder": 0.0, "text_encoder_2": 0.0, "unet": 0.0}
pipe.set_adapters("optimus", adapter_weights=scales)

where pipe is an instance of the FluxPipeline it doesn't error out whereas it should because Flux doesn't have any UNet and its text_encoder_2 component isn't LoRA-loadable:

https://github.com/huggingface/diffusers/blob/31058cdaef63ca660a1a045281d156239fba8192/src/diffusers/loaders/lora_pipeline.py#L1650

Instead, we silently ignore things. This PR fixes this behavior.

Thanks to @asomoza for the idea in https://github.com/huggingface/diffusers/pull/9542#issuecomment-2380411627!

sayakpaul avatar Oct 09 '24 10:10 sayakpaul

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.

@BenjaminBossan thanks!

Apart from that, I'm wondering if we still need the checks starting here:

Good catch. Resolved in 271404336.

sayakpaul avatar Oct 09 '24 12:10 sayakpaul

@DN6 could you give this a look?

sayakpaul avatar Oct 18 '24 05:10 sayakpaul

@DN6 a gentle ping.

sayakpaul avatar Oct 25 '24 14:10 sayakpaul

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Nov 25 '24 15:11 github-actions[bot]

@yiyixuxu @DN6 a gentle ping.

sayakpaul avatar Nov 25 '24 15:11 sayakpaul

@asomoza @yiyixuxu @DN6 could you give this a look?

sayakpaul avatar Dec 08 '24 08:12 sayakpaul

@DN6 I have changed from raising error to raising warnings. Additionally, we're removing the invalid components from the adapter_weights. LMK what you think.

sayakpaul avatar Dec 16 '24 10:12 sayakpaul

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Jan 09 '25 15:01 github-actions[bot]

@hlky could you give this a look?

sayakpaul avatar Feb 19 '25 05:02 sayakpaul