Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions gemma/gm/nn/_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = query_scaled.shape
query_scaled = query_scaled.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
logits = jnp.einsum('BTKGH,BSKH->BTKGS', query_scaled, key_proj)
b, t, k, g, s = logits.shape
Expand Down Expand Up @@ -285,7 +285,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = probs.shape
probs = probs.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
encoded = jnp.einsum('BTKGS,BSKH->BTKGH', probs, value_proj)
b, t, k, g, h = encoded.shape
Expand Down
4 changes: 2 additions & 2 deletions gemma/gm/nn/gemma3n/_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = query_scaled.shape
query_scaled = query_scaled.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
logits = jnp.einsum('BTKGH,BSKH->BTKGS', query_scaled, key_proj)
b, t, k, g, s = logits.shape
Expand Down Expand Up @@ -384,7 +384,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = probs.shape
probs = probs.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
encoded = jnp.einsum('BTKGS,BSKH->BTKGH', probs, value_proj)
b, t, k, g, h = encoded.shape
Expand Down
4 changes: 2 additions & 2 deletions gemma/gm/nn/gemma4/_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = query_proj.shape
query_proj = query_proj.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
logits = jnp.einsum('BTKGH,BSKH->BTKGS', query_proj, key_proj)
b, t, k, g, s = logits.shape
Expand Down Expand Up @@ -362,7 +362,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = probs.shape
probs = probs.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
encoded = jnp.einsum('BTKGS,BSKH->BTKGH', probs, value_proj)
b, t, k, g, h = encoded.shape
Expand Down
4 changes: 2 additions & 2 deletions gemma/research/t5gemma/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = query_scaled.shape
query_scaled = query_scaled.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
logits = jnp.einsum('BTKGH,BSKH->BTKGS', query_scaled, key_proj)
b, t, k, g, s = logits.shape
Expand Down Expand Up @@ -269,7 +269,7 @@ def __call__(
# Reshape matrices to enable einsums over groups.
b, t, kg, h = probs.shape
probs = probs.reshape(
(b, t, self.num_kv_heads, int(kg / self.num_kv_heads), h)
(b, t, self.num_kv_heads, kg // self.num_kv_heads, h)
)
encoded = jnp.einsum('BTKGS,BSKH->BTKGH', probs, value_proj)
b, t, k, g, h = encoded.shape
Expand Down