Running with main branch 98332df and get this error in ip_adapter/attention_processor:430
File "/home/ubuntu/work-dir/InstantID/./ip_adapter/attention_processor.py", line 430, in forward
ip_hidden_states = ip_hidden_states * mask
~~~~~~~~~~~~~~~~~^~~~~~
RuntimeError: The size of tensor a (6400) must match the size of tensor b (9) at non-singleton dimension 1
Possible fix (not sure if this is correct or not)
diff --git a/ip_adapter/attention_processor.py b/ip_adapter/attention_processor.py
index 745143d..db1cd02 100644
--- a/ip_adapter/attention_processor.py
+++ b/ip_adapter/attention_processor.py
@@ -183,7 +183,7 @@ class IPAttnProcessor(nn.Module):
region_mask = region_control.prompt_image_conditioning[0].get('region_mask', None)
if region_mask is not None:
h, w = region_mask.shape[:2]
- ratio = (h * w / query.shape[1]) ** 0.5
+ ratio = (h * w / query.shape[2]) ** 0.5
mask = F.interpolate(region_mask[None, None], scale_factor=1/ratio, mode='nearest').reshape([1, -1, 1])
else:
mask = torch.ones_like(ip_hidden_states)
@@ -422,7 +422,7 @@ class IPAttnProcessor2_0(torch.nn.Module):
region_mask = region_control.prompt_image_conditioning[0].get('region_mask', None)
if region_mask is not None:
h, w = region_mask.shape[:2]
- ratio = (h * w / query.shape[1]) ** 0.5
+ ratio = (h * w / query.shape[2]) ** 0.5
mask = F.interpolate(region_mask[None, None], scale_factor=1/ratio, mode='nearest').reshape([1, -1, 1])
else:
mask = torch.ones_like(ip_hidden_states)
Running with main branch 98332df and get this error in ip_adapter/attention_processor:430
Possible fix (not sure if this is correct or not)