-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[core] Freenoise memory improvements #9262
Merged
Merged
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d0a81ae
update
a-r-r-o-w d55903d
implement prompt interpolation
a-r-r-o-w a86eabe
make style
a-r-r-o-w 94438e1
resnet memory optimizations
a-r-r-o-w 74e3ab0
more memory optimizations; todo: refactor
a-r-r-o-w ec91064
update
a-r-r-o-w 6568681
update animatediff controlnet with latest changes
a-r-r-o-w 76f931d
Merge branch 'main' into animatediff/freenoise-improvements
a-r-r-o-w 761c44d
refactor chunked inference changes
a-r-r-o-w 6830fb0
remove print statements
a-r-r-o-w 49e40ef
Merge branch 'main' into animatediff/freenoise-improvements
a-r-r-o-w 9e215c0
update
a-r-r-o-w 2cef5c7
Merge branch 'main' into animatediff/freenoise-memory-improvements
a-r-r-o-w fb96059
chunk -> split
a-r-r-o-w dc2c12b
remove changes from incorrect conflict resolution
a-r-r-o-w 12f0ae1
remove changes from incorrect conflict resolution
a-r-r-o-w 661a0b3
add explanation of SplitInferenceModule
a-r-r-o-w c55a50a
update docs
a-r-r-o-w 8797cc3
Merge branch 'main' into animatediff/freenoise-memory-improvements
a-r-r-o-w 32961be
Revert "update docs"
a-r-r-o-w 256ee34
update docstring for freenoise split inference
a-r-r-o-w c7bf8dd
apply suggestions from review
a-r-r-o-w 9e556be
add tests
a-r-r-o-w 098bfd1
apply suggestions from review
a-r-r-o-w File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
So, this seems to be a form of chunking?
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.
Yep. At some point lowering the peaks on memory traces, torch.where became the bottleneck. This was actually first noticed by @DN6 so credits to him
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.
Hmm, do we know the situations where
torch.where()
leads to spikes? Seems a little weird to me honestly because native conditionals liketorch.where()
are supposed to be more efficient.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.
I think the spike that we see is due to tensors being copied. The intermediate dimensions for attention get large when generating many frames (let's say, 200+) here. We could do something different here too - I just did what seemed like the easiest thing to do (as these changes were made when I was trying out different things in quick succession to golf the memory spikes)
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.
Ah cool. Let's perhaps make a note of this to reivsit later? At least this way, we are aware?
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.
Alright, made a note. LMK if any further changes needed on this :)