Skip to content

Commit

Permalink
?
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed Nov 4, 2024
1 parent 46d8fa7 commit 006e869
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transformers/models/gemma2/modeling_gemma2.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def tanh_softcap(score, b, h, q_idx, kv_idx):
soft_cap = config.attn_logit_softcapping
score = soft_cap * torch.tanh(score / soft_cap)
if mask is not None:
return score + mask[b][h]
return score + mask[b][h][q_idx][kv_idx]
return score

attn_output = flex_attention(
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/gemma2/modular_gemma2.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def tanh_softcap(score, b, h, q_idx, kv_idx):
soft_cap = config.attn_logit_softcapping
score = soft_cap * torch.tanh(score / soft_cap)
if mask is not None:
return score + mask[b][h]
return score + mask[b][h][q_idx][kv_idx]
return score

attn_output = flex_attention(
Expand Down

0 comments on commit 006e869

Please sign in to comment.