mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 18:26:37 +08:00
Fix relative position scale
This commit is contained in:
parent
9d3ee016c9
commit
83b68a5bdb
2
t5/t5.py
2
t5/t5.py
@ -48,7 +48,7 @@ def _relative_position_bucket(
|
||||
is_small = relative_position < max_exact
|
||||
|
||||
# The other half of the buckets are for logarithmically bigger bins in positions up to max_distance
|
||||
scale = np.log(max_distance / max_exact) * (num_buckets - max_exact)
|
||||
scale = (num_buckets - max_exact) / np.log(max_distance / max_exact)
|
||||
relative_position_if_large = max_exact + (
|
||||
mx.log(relative_position.astype(mx.float32) / max_exact) * scale
|
||||
).astype(mx.int16)
|
||||
|
Loading…
Reference in New Issue
Block a user