-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lot of time positions of kv states are just paddings. We can identi…
…fy the start and slice widths of non-padding kv states by checking atten_mask and the present time_step during extend_step. We then do qk_einsum and pv_enisum only over the non-paddding slices. However, jax won't allow dynamic_slice with variable widths, we have to predefine `chunked_one_step_attn_num_seq_split` number of partial functions, each with fixed slice width, and use jax.lax.switch to pick the corresponding function based on the actual dynamic non-padding width from the input batch. PiperOrigin-RevId: 614069997
- Loading branch information
1 parent
f48a941
commit 0056f19
Showing
2 changed files
with
18 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters