Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/maxtext/layers/attention_mla.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@ def calculate_indexer_loss(

# Aggregate heads: [b, h, t, s] -> [b, t, s]
attention_probs = jnp.sum(attention_probs, axis=1)
# Force materialization and prevent fusion across this point to reuse the intermediate tensor
attention_probs = jax.lax.optimization_barrier(attention_probs)
Comment thread
JHCuc3m marked this conversation as resolved.
# L1 normalize aggregated target distribution
attention_probs = attention_probs / (jnp.sum(attention_probs, axis=-1, keepdims=True) + EPS)

Expand Down
Loading