KohakuBlueleaf / a1111-sd-webui-lycoris

An extension for stable-diffusion-webui to load lycoris models.
Apache License 2.0
862 stars 117 forks source link

Enhancement: Modification of a1111-sd-webui-lycoris to act as standard lora/lycoris handler #34

Closed TheOnlyHolyMoly closed 1 year ago

TheOnlyHolyMoly commented 1 year ago

Preface: Built-in lora extension is currently incapable of handling many new lora formats. Lycoris extension is capable of handling such formats very well.

Goal: Enabling a1111-sd-webui-lycoris extension to act as default lora and lycoris handler for webui Specs: See below (edited as per Vlad's comment below).

vladmandic commented 1 year ago

@KohakuBlueleaf let me know when you've pushed the new code & i'll test it. btw, i think your test image may be overly simple - i don't see any differences in the foreground subject, all of the differences are in the busy background only

i've penciled them here: highlight

KohakuBlueleaf commented 1 year ago

@vladmandic I think the problem is Even if my sample is too simple It should have some pixel different

But there is not Not only my eyes can distinguish them, numpy also said they have exact same pixel value.

And my new code is in lyco-patch-lora branch You can try it

vashter commented 1 year ago

Hello ok I got a few things I want to say.

  1. I'm on 1.3.2. SD Web1111
  2. Lycoris is showing up "skipping unknown extra" and when I went to delete the extension, add new one
  3. the cmd isn't showing up if it loading weight at all
  4. what should I do?
  5. I'm using sd-webui-lycoris + kohya_ss extension
  6. I've try lyco-patch-lora and it still give me a unknown skip Here is the image... image

any help would be great and thanks

KohakuBlueleaf commented 1 year ago

Hello ok I got a few things I want to say.

  1. I'm on 1.3.2. SD Web1111
  2. Lycoris is showing up "skipping unknown extra" and when I went to delete the extension, add new one
  3. the cmd isn't showing up if it loading weight at all
  4. what should I do?
  5. I'm using sd-webui-lycoris + kohya_ss extension
  6. I've try lyco-patch-lora and it still give me a unknown skip Here is the image... image

any help would be great and thanks

Skipping unknown extra network means sd-webui doesn't get any extranetworks for

It is very likely your extension didn't load correctly

And BTW, it is normal that will become unusable once you turn on the --lyco-patch-lora Since it will disable

vladmandic commented 1 year ago

@KohakuBlueleaf i've just repeated bunch of tests and i might have been chasing wrong thing:

there are subtle differences when using lyco-patch-lora and built-in-lora is still enabled i do somewhat expect since lora does some init code on extension load that cannot be skipped. so lyco-patch-lora should be used together with disable built-in-lora for best effect. yes, it works without it disabling lora and its not a big deal, but imo, this is best practice and i can handle that from my side.

any remaining differences seem to be due to non-determinism between my server restarts. even if i use no cross-attention and simplest euler a sampler, there are still some minute numerical differences for identical prompts - this is not due to lora or lyco.

and non-deterministic differences are limited to areas where denoiser has to approximate results more since sampler did not finish (increasing number of steps removes differences) and it depends on precision of vae used - that's why they appear in background details only to start with and are more visible with some models than others. this is an interesting math problem to chase down (eventually), but nothing related to lora/lyco.

as it is, i'm happy with the code as-is - and thank you for all the support.

KohakuBlueleaf commented 1 year ago

@vladmandic so basically Just use the code in main branch? With disabled lora?

vladmandic commented 1 year ago

yup, that's my take right now.

btw, here's an example of non-deterministic run with no lora/lyco, cross-attention disabled and all settings implying there should be no differences (heavily cropped/zoomed) - you can see slight discoloration differences. and for difference to appear, you need to restart server which means its likely about torch initialization (clearly just setting random seed is not enough).

grid

vashter commented 1 year ago

image @KohakuBlueleaf even it is in the extra network, it just doesn't show if it loading weight to allow me to know it working.

vashter commented 1 year ago

image so I try with lora while having lycoris model and I get this "locon load lora method"

vashter commented 1 year ago

image I try to reinstall Lycrois and I get this error something about script issue, realize I had to restart the server and testing more

Edit: guess same results not showing up loading weight in the cmd at all.. out of ideas now, although that "locon load lora method" one seem work but can't tell if it actually really loading the model I'm using.. it use to show loading weight with name of model in cmd before.

image Earlier I try with add detail lora it show up name of the model but not "goodhand-beta2" one for some reason

vashter commented 1 year ago

image I try a different lyconis and nothing show up in cmd, try in a lora that cmd showing that but not the loading weight like the screenshot above.. is something conflict the coding or so?

KohakuBlueleaf commented 1 year ago

@vashter webui has something wrong I guess Checking

And you should uninstall locon ext It is deprecated

vashter commented 1 year ago

@KohakuBlueleaf I went on did a fresh install of SD, haven't gotten the lycrois to work yet in cmd showing up weight some reason even with your latest update + SD 1.3.2 as well and no rush let me know what up

Dasor92 commented 1 year ago

why forcing users who use --lyco patch lora to have their loras inside of Lycoris tab? It breaks almost every extensions (like for example civitai helper)

2blackbar commented 1 year ago

So in the end all the loha lycoris lowhatever models arent that much better than regular loras ? Ive yet to see side by side comparisong with same training data and noticeably better results and not just for clothes of anime char but for likeness of human face.

KohakuBlueleaf commented 1 year ago

So in the end all the loha lycoris lowhatever models arent that much better than regular loras ? Ive yet to see side by side comparisong with same training data and noticeably better results and not just for clothes of anime char but for likeness of human face.

What you said is meaningless in this feature The thing is, all the model can load/run by built-lora, can also run by my extension. But lycoris model cannot.

So @vladmandic want to remove built-in lora in his repo. Which need my extension to replace the built-in lora to ensure ppl can use the old generation parameters

vladmandic commented 1 year ago

i agree. @2blackbar you have fundamental misunderstaanding what is the point here - lyco is not different, its superset. if you use lora, it just works with lyco. if you train locon or lyco or anything thats not standard lora, it doesn't work with built-in lora support.

TheOnlyHolyMoly commented 1 year ago

@vladmandic since the feature is implemented and generally works, I would go ahead and close this thread, will that be okay for?

vladmandic commented 1 year ago

Yes, that's OK with me

TheOnlyHolyMoly commented 1 year ago

Thank you @KohakuBlueleaf for making it happen!!