Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/transformers/models/blip_2/modeling_blip_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ def forward(
**kwargs,
)

attn_output = attn_output.reshape(*input_shape, -1).contiguous()
# NOTE: KV has a different bsz than Q so we take the broadcasted shapes instead of the input shape
attn_output = attn_output.reshape(*attn_output.shape[:2], -1).contiguous()
return attn_output, attn_weights
Comment on lines +605 to 607

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, isn't the bsz supposed to be same as queries? I'm not following how it came out a different bsz

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so as well but I debugged and it apparently wasn't - and tbh I didn't want to go any deeper 😬

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it seems to happen only on the granite model so very weird

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to go any deeper

haha I feel it, as long as the slow CI passes for blips, granitevision, graniteaudio - lets merge then (hopefully I am not missing any models with qformer backbone)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smth saying that the dummy tester inputs weren't prepared correctly to begin with, and we were lucky to not notice it 🙃



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ def forward(
**kwargs,
)

attn_output = attn_output.reshape(*input_shape, -1).contiguous()
# NOTE: KV has a different bsz than Q so we take the broadcasted shapes instead of the input shape
attn_output = attn_output.reshape(*attn_output.shape[:2], -1).contiguous()
return attn_output, attn_weights


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ def forward(
**kwargs,
)

attn_output = attn_output.reshape(*input_shape, -1).contiguous()
# NOTE: KV has a different bsz than Q so we take the broadcasted shapes instead of the input shape
attn_output = attn_output.reshape(*attn_output.shape[:2], -1).contiguous()
return attn_output, attn_weights


Expand Down
Loading