From a9365865c1e4c4037e623e6916a7d3dbe11d64a5 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:28:02 +0300 Subject: [PATCH] better error --- nodes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index ffdf814..48e0799 100644 --- a/nodes.py +++ b/nodes.py @@ -70,9 +70,12 @@ Used with ICLightConditioning -node #Patch ComfyUI's LoRA weight application to accept multi-channel inputs. Thanks @huchenlei try: - lora.calculate_weight = calculate_weight_adjust_channel(lora.calculate_weight) - except: - raise Exception("IC-Light: Could not patch calculate_weight") + if hasattr(lora, 'calculate_weight'): + lora.calculate_weight = calculate_weight_adjust_channel(lora.calculate_weight) + else: + raise Exception("IC-Light: The 'calculate_weight' function does not exist in 'lora'") + except Exception as e: + raise Exception(f"IC-Light: Could not patch calculate_weight - {str(e)}") # Mimic the existing IP2P class to enable extra_conds def bound_extra_conds(self, **kwargs):