Skip to content

[LoRA] relax lora loading logic #4610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 25, 2023
Merged

[LoRA] relax lora loading logic #4610

merged 10 commits into from
Aug 25, 2023

Conversation

sayakpaul
Copy link
Member

Internal discussion thread: https://huggingface.slack.com/archives/C03UQJENJTV/p1692016705461479.

Tested with the following:

import torch
from diffusers import StableDiffusionPipeline

pipeline = StableDiffusionPipeline.from_pretrained(
    "gsdf/Counterfeit-V2.5",
    safety_checker=None,
    use_safetensors=True,
)
pipeline.load_lora_weights("sayakpaul/civitai-light-shadow-lora")

Todo

  • Add an integration test

@sayakpaul sayakpaul requested a review from apolinario August 15, 2023 04:49
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 15, 2023

The documentation is not available anymore as the PR was closed or merged.


targeted_files = list(filter(lambda x: "scheduler" not in x and "optimizer" not in x, targeted_files))
if len(targeted_files) > 1:
raise ValueError(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT if this is a warning not a raise, and we pick the first one? Not a strong opinion tho.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to raise an error than leaving it silent IMO. This promotes a sense to structuring the Hub repos too IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. I thought about doing just a warning and still trying the best guess, like "we picked this, if you meant another one, improve your repo"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. But I think we need to meet at a common point and I would prefer the current design to promote what I said in the earlier comment.

@sayakpaul sayakpaul marked this pull request as ready for review August 16, 2023 09:40
@sayakpaul
Copy link
Member Author

@williamberman could you give this a look?

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Looks good to me

@sayakpaul
Copy link
Member Author

@patrickvonplaten possible to give another thorough look. Had to change a few minor things to make everything work.

Copy link
Contributor

@williamberman williamberman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@sayakpaul sayakpaul merged commit 5222294 into main Aug 25, 2023
@sayakpaul sayakpaul deleted the feat/relax-lora-loading branch August 25, 2023 04:05
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* relax lora loading logic.

* cater to the other cases too.

* fix: variable name

* bring the chaos down.

* check

* deal with checkpointed files.

* Apply suggestions from code review

Co-authored-by: apolinário <[email protected]>

* style

---------

Co-authored-by: apolinário <[email protected]>
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* relax lora loading logic.

* cater to the other cases too.

* fix: variable name

* bring the chaos down.

* check

* deal with checkpointed files.

* Apply suggestions from code review

Co-authored-by: apolinário <[email protected]>

* style

---------

Co-authored-by: apolinário <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants