Skip to content

Commit

Permalink
Merge pull request #588 from IDGallagher/feature/embeds_batch
Browse files Browse the repository at this point in the history
Feature/embeds batch
  • Loading branch information
cubiq authored Jun 4, 2024
2 parents d33265a + 14ef424 commit dc61b4e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions IPAdapterPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ def INPUT_TYPES(s):
}

class IPAdapterEmbeds:

def __init__(self):
self.unfold_batch = False

@classmethod
def INPUT_TYPES(s):
return {
Expand Down Expand Up @@ -1066,6 +1070,7 @@ def apply_ipadapter(self, model, ipadapter, pos_embed, weight, weight_type, star
"end_at": end_at,
"attn_mask": attn_mask,
"embeds_scaling": embeds_scaling,
"unfold_batch": self.unfold_batch,
}

if 'ipadapter' in ipadapter:
Expand All @@ -1082,6 +1087,31 @@ def apply_ipadapter(self, model, ipadapter, pos_embed, weight, weight_type, star

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):
Expand Down Expand Up @@ -1714,6 +1744,7 @@ def combine(self, params_1, params_2, params_3=None, params_4=None, params_5=Non
"IPAdapterTiled": IPAdapterTiled,
"IPAdapterTiledBatch": IPAdapterTiledBatch,
"IPAdapterEmbeds": IPAdapterEmbeds,
"IPAdapterEmbedsBatch": IPAdapterEmbedsBatch,
"IPAdapterStyleComposition": IPAdapterStyleComposition,
"IPAdapterStyleCompositionBatch": IPAdapterStyleCompositionBatch,
"IPAdapterMS": IPAdapterMS,
Expand Down Expand Up @@ -1751,6 +1782,7 @@ def combine(self, params_1, params_2, params_3=None, params_4=None, params_5=Non
"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",
Expand Down

0 comments on commit dc61b4e

Please sign in to comment.