"docs/source/vscode:/vscode.git/clone" did not exist on "f28f240828d7d262767a29be080502ebc5f984fb"
Unverified Commit a2045067 authored by Xiaohan Zou's avatar Xiaohan Zou Committed by GitHub
Browse files

Fix attention mask size checking for CLIP (#13535)

parent 68b0baee
......@@ -229,7 +229,7 @@ class CLIPAttention(nn.Module):
if attention_mask is not None:
if attention_mask.size() != (bsz, 1, tgt_len, src_len):
raise ValueError(
f"Attention mask should be of size {(bsz, 1, tgt_len, src_len)}, but is {causal_attention_mask.size()}"
f"Attention mask should be of size {(bsz, 1, tgt_len, src_len)}, but is {attention_mask.size()}"
)
attn_weights = attn_weights.view(bsz, self.num_heads, tgt_len, src_len) + attention_mask
attn_weights = attn_weights.view(bsz * self.num_heads, tgt_len, src_len)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment