From 9350384f6ed3aa3a2a95747925577affd7a5b097 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Thu, 30 May 2024 01:35:16 +0900 Subject: [PATCH] Allow patches applied to ModelPatcher to be implemented in a general form as functions. --- comfy/model_patcher.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comfy/model_patcher.py b/comfy/model_patcher.py index 2e746d8a9e1..0739e92792d 100644 --- a/comfy/model_patcher.py +++ b/comfy/model_patcher.py @@ -487,6 +487,9 @@ def calculate_weight(self, patches, weight, key): weight += ((strength * alpha) * lora_diff).type(weight.dtype) except Exception as e: logging.error("ERROR {} {} {}".format(patch_type, key, e)) + + elif patch_type == "patch_function": + weight = v(p, weight, key) else: logging.warning("patch type not recognized {} {}".format(patch_type, key))