Add support for torch.compile dynamic shapes#30560
Merged
ArthurZucker merged 4 commits intohuggingface:mainfrom May 20, 2024
Merged
Add support for torch.compile dynamic shapes#30560ArthurZucker merged 4 commits intohuggingface:mainfrom
ArthurZucker merged 4 commits intohuggingface:mainfrom
Conversation
fxmarty
reviewed
Apr 30, 2024
ArthurZucker
approved these changes
May 7, 2024
Collaborator
ArthurZucker
left a comment
There was a problem hiding this comment.
LGTM @fxmarty feel free to merge when CIs are green if it's fine with you!
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Contributor
Author
|
@fxmarty @ArthurZucker I didn't touch Llava. The current "Tensor-likes are not close" error shouldn't have anything to do with this PR. It should be ready to go from my end. |
Collaborator
|
no worries, rebasing on main should most probably fix this! |
ArthurZucker
approved these changes
May 20, 2024
Collaborator
ArthurZucker
left a comment
There was a problem hiding this comment.
Merging as this is quite important. Let's keep an eye on the slow tests that will be triggered!
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for compiling models with dynamic shapes
dynamic=Trueto almost all models with SDPAttention implementations which currently do not support dynamic shapes. #30442 added support for Llama, Gemma, OLMo, & Cohere.The only model not modified is DBRX, which needs the changes from both #30070 and #30442 to add support for SDPA's Flash Attention kernel and support for dynamic shapes, as it I believe it suffers from the same training memory issues detailed in #30010.
As mentioned in #30442, moving the
is_causaldispatch logic from inline to an if statement is required to support bothfullgraph=Trueanddynamic=True.I kept the
qlen>1comments but could remove them if we want to match Llama, which doesn't have it.cc @ArthurZucker and @fxmarty