ogkalu2 / Merge-Stable-Diffusion-models-without-distortion

Adaptation of the merging method described in the paper - Git Re-Basin: Merging Models modulo Permutation Symmetries (https://arxiv.org/abs/2209.04836) for Stable Diffusion
MIT License
139 stars 21 forks source link

Bias toward model b #8

Closed vaguenebula closed 1 year ago

vaguenebula commented 1 year ago

I thought i would make a separate issue for this to keep things organized. So i figured some stuff out. In the original code, the authors apply the permutation after making the final permutation. Here is what I changed in my fork: image

This does give a different model thats not biased. However, the resultant image is blue. I have no idea why.

It turns out that I was normalizing the w_a and w_b, which was causing it to be blue

vaguenebula commented 1 year ago

Just realized

vaguenebula commented 1 year ago

im still getting blue images, so it seems that applying the permutation in this manner gives a different result

ogkalu2 commented 1 year ago

@vaguenebula I also apply the permutation after the weight matching. The code after final_permutation in my code is basically manually applying the apply permutation function. I used the function before nbut changed it manually to see of there was anything up with the function itself. What exactly are you saving in torch.save ? updated_params ?

vaguenebula commented 1 year ago

@vaguenebula I also apply the permutation after the weight matching. The code after final_permutation in my code is basically manually applying the apply permutation function. I used the function before nbut changed it manually to see of there was anything up with the function itself. What exactly are you saving in torch.save ? updated_params ?

For some reason, its giving me a good result. i will submit pull request so you can experiment with the code

vaguenebula commented 1 year ago

@vaguenebula I also apply the permutation after the weight matching. The code after final_permutation in my code is basically manually applying the apply permutation function. I used the function before nbut changed it manually to see of there was anything up with the function itself. What exactly are you saving in torch.save ? updated_params ?

i fixed the blue image now. .its a mix of two models

vaguenebula commented 1 year ago

@vaguenebula I also apply the permutation after the weight matching. The code after final_permutation in my code is basically manually applying the apply permutation function. I used the function before nbut changed it manually to see of there was anything up with the function itself. What exactly are you saving in torch.save ? updated_params ?

it might just be the wrong implementation of the method somehow. im not sure

vaguenebula commented 1 year ago

wait whhhatt im getting model a back now