Skip to content

Support inference with LyCORIS BOFT networks#14871

Merged
AUTOMATIC1111 merged 10 commits intoAUTOMATIC1111:devfrom
v0xie:boft
Feb 19, 2024
Merged

Support inference with LyCORIS BOFT networks#14871
AUTOMATIC1111 merged 10 commits intoAUTOMATIC1111:devfrom
v0xie:boft

Conversation

@v0xie
Copy link
Copy Markdown
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 requested a review from AUTOMATIC1111 as a code owner February 9, 2024 06:09
@v0xie v0xie marked this pull request as draft February 9, 2024 06:10
@w-e-w w-e-w requested a review from KohakuBlueleaf February 9, 2024 06:49
@KohakuBlueleaf
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

This should be fine now.

@KohakuBlueleaf KohakuBlueleaf marked this pull request as ready for review February 18, 2024 07:04
@AUTOMATIC1111
Copy link
Copy Markdown
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
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
ruchej pushed a commit to ruchej/stable-diffusion-webui that referenced this pull request Sep 30, 2024
Support inference with LyCORIS BOFT networks
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.

3 participants