From cadf604de528be62e4fbb1e3d12c51c98f20f50b Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Thu, 11 Jul 2024 23:34:52 +0900 Subject: [PATCH] apply updated IPAdapterPlus's weight type to RegionalIPAdapter nodes --- __init__.py | 2 +- inspire/regional_nodes.py | 24 ++++++++++++++++++++---- pyproject.toml | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index adb83de..a1eff93 100644 --- a/__init__.py +++ b/__init__.py @@ -7,7 +7,7 @@ import importlib -version_code = [0, 81] +version_code = [0, 82] version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '') print(f"### Loading: ComfyUI-Inspire-Pack ({version_str})") diff --git a/inspire/regional_nodes.py b/inspire/regional_nodes.py index 5417c3c..31f331b 100644 --- a/inspire/regional_nodes.py +++ b/inspire/regional_nodes.py @@ -269,6 +269,22 @@ def doit(self, ipadapter_pipe): return model +IPADAPTER_WEIGHT_TYPES_CACHE = None + + +def IPADAPTER_WEIGHT_TYPES(): + global IPADAPTER_WEIGHT_TYPES_CACHE + + if IPADAPTER_WEIGHT_TYPES_CACHE is None: + try: + IPADAPTER_WEIGHT_TYPES_CACHE = nodes.NODE_CLASS_MAPPINGS['IPAdapterAdvanced']().INPUT_TYPES()['required']['weight_type'][0] + except Exception: + print(f"[Inspire Pack] IPAdapterPlus is not installed.") + IPADAPTER_WEIGHT_TYPES_CACHE = ["IPAdapterPlus is not installed"] + + return IPADAPTER_WEIGHT_TYPES_CACHE + + class RegionalIPAdapterMask: @classmethod def INPUT_TYPES(s): @@ -279,7 +295,7 @@ def INPUT_TYPES(s): "image": ("IMAGE",), "weight": ("FLOAT", {"default": 0.7, "min": -1, "max": 3, "step": 0.05}), "noise": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}), - "weight_type": (["original", "linear", "channel penalty"],), + "weight_type": (IPADAPTER_WEIGHT_TYPES(), ), "start_at": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}), "end_at": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}), "unfold_batch": ("BOOLEAN", {"default": False}), @@ -314,7 +330,7 @@ def INPUT_TYPES(s): "image": ("IMAGE",), "weight": ("FLOAT", {"default": 0.7, "min": -1, "max": 3, "step": 0.05}), "noise": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}), - "weight_type": (["original", "linear", "channel penalty"], ), + "weight_type": (IPADAPTER_WEIGHT_TYPES(), ), "start_at": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}), "end_at": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}), "unfold_batch": ("BOOLEAN", {"default": False}), @@ -348,7 +364,7 @@ def INPUT_TYPES(s): "embeds": ("EMBEDS",), "weight": ("FLOAT", {"default": 0.7, "min": -1, "max": 3, "step": 0.05}), - "weight_type": (["original", "linear", "channel penalty"],), + "weight_type": (IPADAPTER_WEIGHT_TYPES(), ), "start_at": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}), "end_at": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}), "unfold_batch": ("BOOLEAN", {"default": False}), @@ -379,7 +395,7 @@ def INPUT_TYPES(s): "embeds": ("EMBEDS",), "weight": ("FLOAT", {"default": 0.7, "min": -1, "max": 3, "step": 0.05}), - "weight_type": (["original", "linear", "channel penalty"],), + "weight_type": (IPADAPTER_WEIGHT_TYPES(), ), "start_at": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.001}), "end_at": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.001}), "unfold_batch": ("BOOLEAN", {"default": False}), diff --git a/pyproject.toml b/pyproject.toml index 79d765c..ddc49f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-inspire-pack" description = "This extension provides various nodes to support Lora Block Weight and the Impact Pack. Provides many easily applicable regional features and applications for Variation Seed." -version = "0.81" +version = "0.82" license = "LICENSE" dependencies = ["matplotlib", "cachetools"]