-
Notifications
You must be signed in to change notification settings - Fork 6k
[LoRA] make set_adapters() method more robust. #9535
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
Conversation
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. |
Failing tests are completely unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this check, I agree it makes sense to prevent typos etc.
I have some comments to potentially improve the code, but no blockers.
check_if_lora_correctly_set(pipe.text_encoder_2), "Lora not correctly set in text encoder 2" | ||
) | ||
|
||
with self.assertRaises(ValueError) as err_context: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use self.assertRaisesRegex
to directly check the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just prefer to do a bit more explicitly across the codebase (which is what I have followed here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick adjustments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Co-authored-by: YiYi Xu <yixu310@gmail.com>
* make set_adapters() method more robust. * remove patch * better and concise code. * Update src/diffusers/loaders/lora_base.py Co-authored-by: YiYi Xu <yixu310@gmail.com> --------- Co-authored-by: YiYi Xu <yixu310@gmail.com>
* make set_adapters() method more robust. * remove patch * better and concise code. * Update src/diffusers/loaders/lora_base.py Co-authored-by: YiYi Xu <yixu310@gmail.com> --------- Co-authored-by: YiYi Xu <yixu310@gmail.com>
What does this PR do?
First caught in #9525 (comment) by @asomoza. But then it turned out to be #9525 (comment).
This PR:
set_adapters()
method more robust by catching errors on adapter names that are wrong (and adds a test for it).set_adapters()
more robust.@cshowley do you wanna give this a try?