a2569875 / stable-diffusion-webui-composable-lora

This extension replaces the built-in LoRA forward procedure.
GNU Affero General Public License v3.0
155 stars 14 forks source link

Extension is always active and causes massive slowdown when used with LyCORIS model #4

Closed Haoming02 closed 1 year ago

Haoming02 commented 1 year ago

The Issue

When using a LyCORIS model with this Extension, this Extension is still activated even when Enabled is not checked, and this line is shown in the console: Found LyCORIS models, Using Composable LyCORIS. for every generation. On top of that, this causes significant reduction in processing speed. Only after I completely removed this Extension from the folder did the slowdown go away.

Environment

Speed Test (v1.2.1 Webui ; RTX 3060 ; --xformers)

it/s A B C D
2nd 7.90 N/A 7.92 3.89
3rd 7.95 N/A 7.83 3.85
4th 8.00 N/A 7.90 3.87

Note: Taking the 2nd ~ 4th run since the 1st run is often slower

Haoming02 commented 1 year ago

Updating to the latest commit(6b55dd52) fixed the previous issue. Now the slowdown and the log only show up when Enabled is checked. However, a new issue rised:

New Issue

If you enable then disable the extension, the LyCORIS model stops working completely.

Repro

  1. Launch webui
  2. Add LyCORIS syntax. See normal processing speed and correct generation.
  3. Tick the Enabled checkbox.
  4. See reduced processing speed and correct generation.
  5. Untick Enabled.
  6. See normal processing speed and incorrect generation...
Haoming02 commented 1 year ago

Additionally, after the above issue occurs, clicking Reload UI at the bottom does not resolve it either. I had to close the console and restart the webui completely for the LyCORIS model to work again.

a2569875 commented 1 year ago

@Haoming02 This issue is very difficult to fix because the new version (1.2) of the LoRA mechanism caches all LoRA and LyCoris before the drawing starts. This mechanism causes all prompt blocks and drawing steps to use the same set of LoRA configurations, completely lacking support for Composable LoRA. In order to make Composable LoRA work, I can only clear the LoRA cache and manually read and assign LoRA weights in each prompt block and drawing step. However, LoRA and LyCoris have their own caches, which means that when I clear the cache, the caches of LoRA and LyCoris will conflict with each other. If I handle the LoRA cache correctly, the LyCoris cache will have issues, and if I handle the LyCoris cache correctly, the LoRA cache will have issues.

If the problem persists, please clear all LyCoris prompts, generate an image without loading any LyCoris, and then switch to loading another LyCoris that hasn't been loaded before, generate an image, triggering a forced update of the LyCoris cache to see if there is any improvement.

If the issue remains unresolved, switch the Base Model Checkpoint to force the recalculation of the caches for both LoRA and LyCoris, and see if there is any improvement.

Thank you.

Haoming02 commented 1 year ago

oof Yeah, that sounds rough.

Thanks for all your works though.