-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Convert alphas for embedders for sd-scripts to ai toolkit conversion #12332
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
Convert alphas for embedders for sd-scripts to ai toolkit conversion #12332
Conversation
assign_remaining_weights( | ||
[ |
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.
Why is this going away? From what I understand, assign_remaining_weights()
is doing the same thing as what the changes in this PR are doing no?
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.
It isn't converting the alphas so instead of making assign_remaining_weights do the alpha I thought to use the other function (_convert_to_ai_toolkit
) here. Maybe I'm missing the key reason this was being used instead.
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.
Ah okay. That makes sense.
Could we run the integration tests for Flux LoRA before we merge this PR?
diffusers/tests/lora/test_lora_layers_flux.py
Line 816 in 751e250
class FluxLoRAIntegrationTests(unittest.TestCase): |
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.
I couldn't run all the tests due to my PC and even these I had to disable all the skips for this to run. But I was able to complete the test for the new test. If you need more of the tests run I can try though.
RUN_SLOW=1 RUN_NIGHTLY=1 python -m pytest tests/lora/test_lora_layers_flux.py -k test_flux_kohya_embedders_conversion
platform linux -- Python 3.13.5, pytest-8.4.2, pluggy-1.6.0
rootdir: /home/rockerboo/code/others/diffusers
configfile: pyproject.toml
plugins: timeout-2.4.0, requests-mock-1.10.0, xdist-3.8.0
collected 122 items / 121 deselected / 1 selected
tests/lora/test_lora_layers_flux.py .
1 passed, 121 deselected, 3 warnings in 555.38s (0:09:15)
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.
Sorry, I meant the other tests that we have in the test suite. Let me try to run them.
@bot /style |
Style bot fixed some files and pushed the changes. |
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. |
Just ran all the tests and they pass. Will merge the PR after the CI is through. |
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.
Super cool!
What does this PR do?
Converts the alpha + weight for embedders (guidance, txt/img, vector, timestep) from Kohya sd-scripts into diffusers format. There was a
# TODO: alphas
and this uses the function to convert these over using the one with alphas. Remaining is the final_layer but that is a bit different due to the transform function.Added a test from a LoRA I made with these using Kohya sd-scripts.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@sayakpaul