Skip to content

Commit

Permalink
align attention patch with ipadapter
Browse files Browse the repository at this point in the history
  • Loading branch information
matt3o committed Apr 9, 2024
1 parent 4b900cf commit 59d6008
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions CrossAttentionPatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, ipadapter=None, number=0, weight=1.0, cond=None, cond_alt=Non
self.unfold_batch = [unfold_batch]
self.embeds_scaling = [embeds_scaling]
self.number = number
self.layers = 11 if '101_to_k_ip' in ipadapter.ip_layers.to_kvs else 15 # TODO: check if this is a valid condition to detect all models
self.layers = 11 if '101_to_k_ip' in ipadapter.ip_layers.to_kvs else 16 # TODO: check if this is a valid condition to detect all models

self.k_key = str(self.number*2+1) + "_to_k_ip"
self.v_key = str(self.number*2+1) + "_to_v_ip"
Expand Down Expand Up @@ -72,12 +72,6 @@ def __call__(self, q, k, v, extra_options):
weight = weight * 0.2
elif weight_type == 'strong middle' and (block_type == 'input' or block_type == 'output'):
weight = weight * 0.2
elif weight_type.startswith('style transfer'):
if t_idx != 6:
continue
elif weight_type.startswith('composition'):
if t_idx != 3:
continue
elif isinstance(weight, dict):
if t_idx not in weight:
continue
Expand Down

0 comments on commit 59d6008

Please sign in to comment.