From 1d13d6a86748e2e9c331f8af6b116036284f3c39 Mon Sep 17 00:00:00 2001 From: ntc-ai Date: Mon, 1 Jul 2024 14:12:05 -0600 Subject: [PATCH] apply alpha on weight_calc --- comfy/model_patcher.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index b949031e9..3a96fd0f7 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -11,7 +11,6 @@ from comfy.types import UnetWrapperFunction def weight_decompose(dora_scale, weight, lora_diff, alpha, strength): dora_scale = comfy.model_management.cast_to_device(dora_scale, weight.device, torch.float32) - lora_diff *= alpha weight_calc = weight + lora_diff.type(weight.dtype) weight_norm = ( weight_calc.transpose(0, 1) @@ -22,9 +21,9 @@ def weight_decompose(dora_scale, weight, lora_diff, alpha, strength): ) weight_calc *= (dora_scale / weight_norm).type(weight.dtype) - if strength != 1.0: + if strength != 1.0 or alpha != 1.0: weight_calc -= weight - weight += strength * (weight_calc) + weight += strength * alpha * weight_calc else: weight[:] = weight_calc return weight