From d367123810662da887b92c532e3803fb164e9a46 Mon Sep 17 00:00:00 2001 From: IDGallagher Date: Tue, 4 Jun 2024 01:15:04 +0100 Subject: [PATCH] Added IPAdapterEmbedsBatch node to enable unfold_batch when using batched embeds --- IPAdapterPlus.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/IPAdapterPlus.py b/IPAdapterPlus.py index 28bed51..164167b 100644 --- a/IPAdapterPlus.py +++ b/IPAdapterPlus.py @@ -985,6 +985,10 @@ class IPAdapterTiledBatch(IPAdapterTiled): } class IPAdapterEmbeds: + + def __init__(self): + self.unfold_batch = False + @classmethod def INPUT_TYPES(s): return { @@ -1019,6 +1023,7 @@ class IPAdapterEmbeds: "end_at": end_at, "attn_mask": attn_mask, "embeds_scaling": embeds_scaling, + "unfold_batch": self.unfold_batch, } if 'ipadapter' in ipadapter: @@ -1035,6 +1040,31 @@ class IPAdapterEmbeds: return ipadapter_execute(model.clone(), ipadapter_model, clip_vision, **ipa_args) +class IPAdapterEmbedsBatch(IPAdapterEmbeds): + + def __init__(self): + self.unfold_batch = True + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "model": ("MODEL", ), + "ipadapter": ("IPADAPTER", ), + "pos_embed": ("EMBEDS",), + "weight": ("FLOAT", { "default": 1.0, "min": -1, "max": 3, "step": 0.05 }), + "weight_type": (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 }), + "embeds_scaling": (['V only', 'K+V', 'K+V w/ C penalty', 'K+mean(V) w/ C penalty'], ), + }, + "optional": { + "neg_embed": ("EMBEDS",), + "attn_mask": ("MASK",), + "clip_vision": ("CLIP_VISION",), + } + } + class IPAdapterMS(IPAdapterAdvanced): @classmethod def INPUT_TYPES(s): @@ -1667,6 +1697,7 @@ NODE_CLASS_MAPPINGS = { "IPAdapterTiled": IPAdapterTiled, "IPAdapterTiledBatch": IPAdapterTiledBatch, "IPAdapterEmbeds": IPAdapterEmbeds, + "IPAdapterEmbedsBatch": IPAdapterEmbedsBatch, "IPAdapterStyleComposition": IPAdapterStyleComposition, "IPAdapterStyleCompositionBatch": IPAdapterStyleCompositionBatch, "IPAdapterMS": IPAdapterMS, @@ -1704,6 +1735,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "IPAdapterTiled": "IPAdapter Tiled", "IPAdapterTiledBatch": "IPAdapter Tiled Batch", "IPAdapterEmbeds": "IPAdapter Embeds", + "IPAdapterEmbedsBatch": "IPAdapter Embeds Batch", "IPAdapterStyleComposition": "IPAdapter Style & Composition SDXL", "IPAdapterStyleCompositionBatch": "IPAdapter Style & Composition Batch SDXL", "IPAdapterMS": "IPAdapter Mad Scientist",