Skip to content

Commit 043a4a3

Browse files
authored
Update softcapping.py (#23)
1 parent 5e0d1b8 commit 043a4a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

attn_gym/mods/softcapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_tanh_softcap(soft_cap: int, approx: bool = False) -> _score_mod_sig
6565
tanh = _tanh_approx if approx else torch.tanh
6666

6767
def tanh_softcap(score, b, h, q_idx, kv_idx):
68-
return score * tanh(score / soft_cap)
68+
return soft_cap * tanh(score / soft_cap)
6969

7070
prefix = "tanh_softcap_approx" if approx else "tanh_softcap"
7171
tanh_softcap.__name__ = f"{prefix}_{soft_cap}"

0 commit comments

Comments
 (0)