[LoRA] clean up load_lora_into_text_encoder()
and fuse_lora()
copied from by sayakpaul · Pull Request #10495 · huggingface/diffusers (original) (raw)
What does this PR do?
load_lora_into_text_encoder()
The load_lora_into_text_encoder()
method is basically copied for all the pipelines that support LoRAs on their text encoders. Since the method is duplicated across the different LoRA classes, we can just factor it out to reduce the LoCs.
fuse_lora()
We should not allow the components that are not LoRA-loadable in the signature of fuse_lora()
and unfuse_lora()
. This wasn't caught because in the tests, we explicitly pass _lora_loadable_modules
:
pipe.fuse_lora(components=self.pipeline_class._lora_loadable_modules) |
---|
TODOs
- Run the integration tests.