From 6ad0a6d7e2f656af2e0ad501db6d9f5d14ae7add Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 9 Jul 2023 17:46:56 -0400 Subject: [PATCH] Don't patch weights when multiplier is zero. --- comfy/sd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/comfy/sd.py b/comfy/sd.py index 526dc531..4bc9a15f 100644 --- a/comfy/sd.py +++ b/comfy/sd.py @@ -359,10 +359,11 @@ class ModelPatcher: 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]