Skip to content
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

Support inference with LyCORIS BOFT networks #14871

Merged
merged 10 commits into from Feb 19, 2024
Merged

Conversation

v0xie
Copy link
Contributor

@v0xie v0xie commented Feb 9, 2024

Description

This draft PR adds support for inference of BOFT networks trained with the dev branch of LyCORIS. The implementation is based on @KohakuBlueleaf's implementation here: https://github.com/KohakuBlueleaf/LyCORIS/blob/dev/lycoris/modules/boft.py

Since the name "oft_diag" is the same between OFT and BOFT, I think the simplest way to differentiate the two is the dimension of the weights (OFT: 3, BOFT: 4).

The calc_updown code is slightly modified from the get_weight function in the original. I'm not sure what to do about the scale parameter so I leave it at 1.0.

Screenshots/videos:

Checklist:

@v0xie v0xie marked this pull request as draft February 9, 2024 06:10
@KohakuBlueleaf
Copy link
Collaborator

KohakuBlueleaf commented Feb 9, 2024

@v0xie For the compatibility of "load weight"

I may change the content of state dict in the near future. (Will be something in LyCORIS 2.1.0)

Will review and refine this in next week

LyCORIS will support save oft_blocks instead of oft_diag in the near future (for both OFT and BOFT)

But this means we need to store the rescale if user enable it.
@KohakuBlueleaf
Copy link
Collaborator

This should be fine now.

@KohakuBlueleaf KohakuBlueleaf marked this pull request as ready for review February 18, 2024 07:04
@AUTOMATIC1111
Copy link
Owner

There is an execution path where is_boft property is not added. I recommend putting

self.is_kohya = False
self.is_boft = False

before if/else checks.

@AUTOMATIC1111 AUTOMATIC1111 merged commit 6e4fc5e into AUTOMATIC1111:dev Feb 19, 2024
3 checks passed
AUTOMATIC1111 added a commit that referenced this pull request Feb 19, 2024
Support inference with LyCORIS BOFT networks
@pawel665j pawel665j mentioned this pull request Apr 16, 2024
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.

None yet

3 participants