Fix incorrect patch in zero.init#5921
Closed
VeryLazyBoy wants to merge 9 commits intodeepspeedai:masterfrom
Closed
Fix incorrect patch in zero.init#5921VeryLazyBoy wants to merge 9 commits intodeepspeedai:masterfrom
VeryLazyBoy wants to merge 9 commits intodeepspeedai:masterfrom
Conversation
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
Author
|
A better solution is proposed to handle |
Collaborator
|
Thank you @VeryLazyBoy for the great catch! I think the issue is that we patch superclass's |
Contributor
Author
|
@tohtana Yes! Your approach is less intrusive and much better. Let's go ahead with this new method. Should I close this merge request? |
Collaborator
|
@VeryLazyBoy Thank you for your response! |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Sep 4, 2024
This PR fixes an issue addressed in #5921. With this change, we only apply the patch for parameter partitioning to classes that have `__init__` so that we can avoid applying the patch multiple times. The class that does not have `__init__` now uses its superclass's one. So this PR also applies the patch to the root class, `torch.nn.modules.module.Module`. Thanks @VeryLazyBoy for the report and initial solution. --------- Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
mauryaavinash95
pushed a commit
to DataStates/DeepSpeed
that referenced
this pull request
Mar 20, 2025
This PR fixes an issue addressed in deepspeedai#5921. With this change, we only apply the patch for parameter partitioning to classes that have `__init__` so that we can avoid applying the patch multiple times. The class that does not have `__init__` now uses its superclass's one. So this PR also applies the patch to the root class, `torch.nn.modules.module.Module`. Thanks @VeryLazyBoy for the report and initial solution. --------- Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
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.
The code below has a problem where
cls.__init__in line 525 can be modified before assignment to_old_init. This could lead to an incorrect__init__being backed up:https://github.com/microsoft/DeepSpeed/blob/ffe0af23575c4f03a07408eacfc50b1a58781429/deepspeed/runtime/zero/partition_parameters.py#L524-L534
Test Case