-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Use 2x less memory for MoE (including the DisposableTensor small tool) #5085
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
Closed
Conversation
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
5ce3a41 to
5c3d1b5
Compare
Closed
This reverts commit 740cd8a.
ch-wan
reviewed
Apr 17, 2025
Collaborator
Author
|
Title seems to be inaccurate - 2x memory save is due to multiple changes |
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.
UPDATE: latest PR is in #6147
Brainstorm: maybe we can use
the_tensor.set_(torch.empty((0,), device=...))(e.g. if users do not need to access metadata of the tensor after this operation)2025.04.21 Update
I observe something similar for forward_deepgemm_masked. Will update this PR containing that as well. For users who need it before this PR is extracted from my dev branch, please directly visit #5524
Original text
Do NOT look at the code now - it is based on two-batch-overlap branch (b/c that branch merges the tools branches). I will re-do the things on master branch later.Updated
Before: peak 1.8+1.8+1.8GB = 5.4GB
After: peak is 1.8+0.9GB = 2.7GB
04.12: Updated the code, and re-checked the memory profile which still looks reasonable
Motivation
Modifications
Checklist