-
Notifications
You must be signed in to change notification settings - Fork 803
fix: make_mask uses deprecated jnp.bool instead of jnp.bool_ #3371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,7 +224,7 @@ def make_mask( | |
| segment_pos_q, | ||
| segment_pos_kv, | ||
| window_size, | ||
| dtype=jnp.bool, | ||
| dtype=jnp.bool_, | ||
| segment_ids_q=segment_ids_q, | ||
| segment_ids_kv=segment_ids_kv, | ||
| ) | ||
|
|
@@ -236,6 +236,23 @@ def make_mask( | |
| return mask | ||
|
|
||
|
|
||
| def test_make_mask_bottom_right_swa_dtype(): | ||
| """Regression test: make_mask bottom-right branch should use jnp.bool_, not jnp.bool.""" | ||
| batch, seqlen = 2, 16 | ||
| segment_ids = jnp.ones((batch, seqlen), dtype=jnp.int32) | ||
| segment_pos = jnp.broadcast_to(jnp.arange(seqlen, dtype=jnp.int32), (batch, seqlen)) | ||
| window_size = (4, 0) | ||
| mask = make_mask( | ||
| segment_ids, | ||
| segment_ids, | ||
| segment_pos, | ||
| segment_pos, | ||
| AttnMaskType.PADDING_CAUSAL_BOTTOM_RIGHT_MASK, | ||
| window_size, | ||
| ) | ||
| assert mask.dtype == jnp.bool_ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This assertion checks only the final mask dtype, which is boolean after the logical mask operations whether Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
|
|
||
|
|
||
| @jax.jit | ||
| def get_seqlens_and_offsets(segment_ids): | ||
| batch, max_seqlen = segment_ids.shape | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We seem to have a few other call sites of
jnp.bool? If it's deprecated, could we fix those ones as well? Thanks.I think we can get away with the test as well.