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

Previews don't match saved merge #86

Open
CaptainVarghoss opened this issue Dec 14, 2023 · 2 comments
Open

Previews don't match saved merge #86

CaptainVarghoss opened this issue Dec 14, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@CaptainVarghoss
Copy link

I was using this extension to fix a merge that had contiguous tensor errors in other extensions and programs (thanks for that!)

During my testing I was attempting to simply pass through an existing model with no actual merging, so I set the multiplier on model B to 0. Clicked generate, confirmed a merge didn't change anything, then saved the checkpoint.

Switched to the new checkpoint and generated the same image using the same seed and prompt, and the image is different.

My first assumption was that something in the contiguous repair had changed the model but after more testing, it seems like no matter what model I use, merging it with nothing shows a preview image differing from what actually saves to file.

This leads me to believe that something IS being merged or changed during 'live' generation, but it's not saved with the checkpoint.

I've attached 3 images with metadata intact.

First is before merger.
20231213_215022_1352062077

Second is the preview of merging the checkpoint with itself (B) set to 0 alpha (should produce identical checkpoint and images).
20231213_215137_1352062077

Third is generated after checkpoint is saved after step 2 above.
20231213_215807_1352062077

The first and third images are identical nearly identical despite the different preview before merge.

EXTRA NOTE:
While writing this up and re-testing everything to make sure I was testing properly I found that the first and third images ARE in-fact different but they shouldn't be, and even if they are supposed to be different they still don't match the non-saved merge.

tl;dr - The image displayed testing a merge is not the image generated after saving that merge. Expected behavior is that these match exactly.

@wkpark
Copy link
Owner

wkpark commented Dec 14, 2023

thank your for your feedback!

I've just tested using a SD1.5 model as follow:

..(snip)..
config hash =  a0b03d5f552ec770ff274d77a1c86af6c46b198013c4e165ae5dd7505d3038a6
  - mm_use [True, False, False, False]
  - model_a blessingMix_V1Fp16-vae.safetensors [267ad1beb5]
  - base_model None
  - max_models 4
  - models ['f222-Fp32.safetensors [f300684443]']
  - modes ['Sum(lerp)']
  - calcmodes ['Normal']
  - usembws [['ALL']]
  - weights ['0']
  - alpha [0.5]
  - adjust
  - use elemental [False]
  - elementals [':time_embed:1,:out:0.6']
model_a = blessingMix_V1Fp16-vae
Loading from file F:\webui\webui\stable-diffusion-webui\models\Stable-diffusion\blessingMix_V1Fp16-vae.safetensors...
isxl = False
compact_mode =  True
Loading model f222-Fp32...
Loading from file F:\webui\webui\stable-diffusion-webui\models\Stable-diffusion\f222-Fp32.safetensors...
mode = Sum(lerp), mbw mode, alpha = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Stage #1/3: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 882/882 [00:00<00:00, 294231.78it/s]
Check uninitialized #2/3: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 882/882 [00:00<00:00, 147045.72it/s]
Save unchanged weights #3/3: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 251/251 [00:00<?, ?it/s]
Clip is fine
 - merge processing in 0.2s (prepare: 0.2s).
 - precalculated hash =  e118c4736f0874a22f97b653b268ae69da0f6999356851c0c7c5dedea33eb287
Saving...
isxl =  False
Clip is fine
 - check contiguous...
Successfully model saved! - F:\webui\webui\stable-diffusion-webui\models\Stable-diffusion\tmpx1.fp16.safetensors
Done!
 - post process in 9.3s (precalculate hash: 6.2s, save model: 3.0s).

(...snip)

as your suggest, all weights are 0.0 and generated images are almost same.

(merged model result)
00062-2302035655-blessingMix_V1Fp16-vae x (1 - alpha_0) + f222-Fp32 x alpha_0(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

(non merged)
00063-2302035655-blessingMix_V1Fp16-vae


you can enable "save model" in the Settings->Model-Mixer

image

and you can test your merged model by SuperMerger's Analysis functionality.

@wkpark
Copy link
Owner

wkpark commented Dec 14, 2023

and what you mean different preview?
you mean, the live preview is different from the saved image??

(I guess, something was wrong with other extensions)

@wkpark wkpark self-assigned this Dec 17, 2023
@wkpark wkpark added the help wanted Extra attention is needed label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants