Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
17.04k stars 1.96k forks source link

[Feature] i find suitable scales for t2i adapter guess mode #269

Closed lllyasviel closed 1 year ago

lllyasviel commented 1 year ago

Because t2i adapter has fewer layers, weightings like 0.825**n will not work very well. After trying many possible weights, the below weights seem to work:

feature_64: 0.25 feature_32: 0.62 feature_16: 0.825 feature_8: 1.0

Let me know what you think or should i post some examples

lllyasviel commented 1 year ago

Because t2i adapter's encoder is lighter, their guess mode will look like this image image image image These results may be interesting in "pure guesses"; but with prompts, perhaps in some cases it will still improve the result a bit. But since we already have guess mode for some models, perhaps we should implement all.

lllyasviel commented 1 year ago

thanks very much! is it possible to put this in a bit higher priority? we are trying to perform some experiments in webui but if we can get this done we can simply reuse your codes. I tried this plugin today and this plugin is really awesome well done!

Mikubill commented 1 year ago

already added in https://github.com/Mikubill/sd-webui-controlnet/pull/262, will merge later after some tests

lllyasviel commented 1 year ago

thanks! looking forward!

lllyasviel commented 1 year ago

Hi the quality of results do not look similar to my results. seems something is not very correct. image

lllyasviel commented 1 year ago

My results are achieved by disconnect t2i adapter in uncond, and then on the cond side we use 0.25, 0.62, 0.825, 1.0 as weights. 1.0 is for the 8*8 layer. I am also looking at the codes my self to detect differences.

lllyasviel commented 1 year ago

clearly not a problem of PLMS image

Mikubill commented 1 year ago

Seems like adapter haven't disconnect on unconditional side, will fix later

Mikubill commented 1 year ago

misclicked. try with the latest commit

lllyasviel commented 1 year ago

let me try

lllyasviel commented 1 year ago

what happened? image

lllyasviel commented 1 year ago

clearly a bug, but why is this even possible? ? ? i do not input prompts but image quality very high!

lllyasviel commented 1 year ago

find a way to reproduce it. load a img, generate, then click guesss mode, then generate, then change to ddim, then generate. boom! bug happens

lllyasviel commented 1 year ago

god. these steps not needed. just guess mode+ ddim+pidnet+t2i sketch

lllyasviel commented 1 year ago

god godess

lllyasviel commented 1 year ago

absolutely impossible image

lllyasviel commented 1 year ago

I must know what happens.

lllyasviel commented 1 year ago

my controlnet also has this image

amazing. what happens????

Mikubill commented 1 year ago

Tested with Euler a and it seems….fine? grid-0104-2 Maybe some assertions not fully compatible with non-k-diffusion samplers. (DDIM/PLMS)

lllyasviel commented 1 year ago

but what happens with ddim? this deserves a new paper! can we use this to extract the entire dataset of a diffusion model?

Mikubill commented 1 year ago

fixed in https://github.com/Mikubill/sd-webui-controlnet/commit/5a0fa4bd13bf49274e2075a3bd9909643104d8e9. Now it should generate similar result as other samplers does.

Root cause of that is vanilla samplers (DDIM/PMLS) using different input format than k-diffusion samplers, which is [uncond, cond] and [cond, uncond]. it's actually interesting: adding controlnet/adapter to uncond only could also produce good result. (and not related to input image)

before: photo_2023-02-22 19 03 39

after: Screenshot 2023-02-22 at 19 03 48

lllyasviel commented 1 year ago

goddess. We need to delete this issue and not let others know.