Skip to content

Commit

Permalink
fix rebasin pix2pix+inpainting
Browse files Browse the repository at this point in the history
  • Loading branch information
s1dlx committed Jul 28, 2023
1 parent 9212347 commit 23999ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion sd_meh/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def merge_key(

# dealing wiht pix2pix and inpainting models
if (a_size := merge_args["a"].size()) != (b_size := merge_args["b"].size()):
print(key, a_size, b_size)
if a_size[1] > b_size[1]:
merged_key = merge_args["a"]
else:
Expand Down
10 changes: 7 additions & 3 deletions sd_meh/rebasin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2199,9 +2199,13 @@ def apply_permutation(ps: PermutationSpec, perm, params):

def update_model_a(ps: PermutationSpec, perm, model_a, new_alpha):
for k in model_a:
model_a[k] = model_a[k] * (1 - new_alpha) + new_alpha * get_permuted_param(
ps, perm, k, model_a
)
try:
perm_params = get_permuted_param(
ps, perm, k, model_a
)
model_a[k] = model_a[k] * (1 - new_alpha) + new_alpha * perm_params
except RuntimeError: # dealing with pix2pix and inpainting models
continue
return model_a


Expand Down

0 comments on commit 23999ff

Please sign in to comment.