cosxl edit support (tentatively)

This commit is contained in:
cubiq
2024-06-09 12:11:38 +02:00
parent f904b4c3c3
commit 7d8adaec73
2 changed files with 1630 additions and 2 deletions
+6 -2
View File
@@ -124,8 +124,12 @@ def ipadapter_attention(out, q, k, v, extra_options, module_key='', ipadapter=No
v_cond = ipadapter.ip_layers.to_kvs[v_key](cond).repeat(batch_prompt, 1, 1)
v_uncond = ipadapter.ip_layers.to_kvs[v_key](uncond).repeat(batch_prompt, 1, 1)
ip_k = torch.cat([(k_cond, k_uncond)[i] for i in cond_or_uncond], dim=0)
ip_v = torch.cat([(v_cond, v_uncond)[i] for i in cond_or_uncond], dim=0)
if len(cond_or_uncond) == 3: # TODO: conxl, I need to check this
ip_k = torch.cat([(k_cond, k_uncond, k_cond)[i] for i in cond_or_uncond], dim=0)
ip_v = torch.cat([(v_cond, v_uncond, v_cond)[i] for i in cond_or_uncond], dim=0)
else:
ip_k = torch.cat([(k_cond, k_uncond)[i] for i in cond_or_uncond], dim=0)
ip_v = torch.cat([(v_cond, v_uncond)[i] for i in cond_or_uncond], dim=0)
if embeds_scaling == 'K+mean(V) w/ C penalty':
scaling = float(ip_k.shape[2]) / 1280.0
File diff suppressed because it is too large Load Diff