Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
Better support IPAttnProcessor2_0
  • Loading branch information
ResearcherXman authored Feb 1, 2024
1 parent 98332df commit e36ca46
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ip_adapter/attention_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def forward(
if len(region_control.prompt_image_conditioning) == 1:
region_mask = region_control.prompt_image_conditioning[0].get('region_mask', None)
if region_mask is not None:
query = query.reshape([-1, query.shape[-2], query.shape[-1]])
h, w = region_mask.shape[:2]
ratio = (h * w / query.shape[1]) ** 0.5
mask = F.interpolate(region_mask[None, None], scale_factor=1/ratio, mode='nearest').reshape([1, -1, 1])
Expand All @@ -443,4 +444,4 @@ def forward(

hidden_states = hidden_states / attn.rescale_output_factor

return hidden_states
return hidden_states

0 comments on commit e36ca46

Please sign in to comment.