Skip to content

Commit

Permalink
apply updated IPAdapterPlus's weight type to RegionalIPAdapter nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Jul 11, 2024
1 parent ccd472e commit cadf604
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})")

Expand Down
24 changes: 20 additions & 4 deletions inspire/regional_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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}),
Expand Down Expand Up @@ -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}),
Expand Down Expand Up @@ -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}),
Expand Down Expand Up @@ -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}),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit cadf604

Please sign in to comment.