Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, when using causal_mask="BottomRight" in R.nn.attention, the legalization would assume that the query and key/value sequence lengths were static integers. This commit updates the legalization to allow dynamic shapes.

Copy link
Contributor

@slyubomirsky slyubomirsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch and it's a nice improvement. We should really have "always think about the dynamic case" as a motto.

@Lunderberg
Copy link
Contributor Author

We should really have "always think about the dynamic case" as a motto.

I like the motto, as it's the most user-friendly option at a high level. Since specialization can go from dynamic to static, but going from static to dynamic would be ambiguous, I really like "dynamic until specialized" as the default behavior.

@Lunderberg Lunderberg merged commit 4b7d78d into apache:main Feb 22, 2024
@Lunderberg Lunderberg deleted the relax_legalize_dynamic_nn_attention branch February 22, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants