Skip to content

Commit

Permalink
Don't patch weights when multiplier is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 9, 2023
1 parent af15add commit 6ad0a6d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions comfy/sd.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,11 @@ def calculate_weight(self, patches, weight, key):

if len(v) == 1:
w1 = v[0]
if w1.shape != weight.shape:
print("WARNING SHAPE MISMATCH {} WEIGHT NOT MERGED {} != {}".format(key, w1.shape, weight.shape))
else:
weight += alpha * w1.type(weight.dtype).to(weight.device)
if alpha != 0.0:
if w1.shape != weight.shape:
print("WARNING SHAPE MISMATCH {} WEIGHT NOT MERGED {} != {}".format(key, w1.shape, weight.shape))
else:
weight += alpha * w1.type(weight.dtype).to(weight.device)
elif len(v) == 4: #lora/locon
mat1 = v[0]
mat2 = v[1]
Expand Down

0 comments on commit 6ad0a6d

Please sign in to comment.