-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Destroy ZeRO #4383
base: master
Are you sure you want to change the base?
Destroy ZeRO #4383
Conversation
@@ -519,6 +519,9 @@ def __init__(self, | |||
self._enable_universal_checkpoint() | |||
self._param_slice_mappings = self._create_param_mapping() | |||
|
|||
def destroy(self): | |||
self._uncreate_param_mapping() |
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.
Don't we need to delete the buffers related to contiguous_gradients and gradient_partitions?
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.
Deleting those buffers didn't make a difference when running experiments but I can add a full delete of all attributes for completeness just as I did for ZeRO 3.
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.
Sounds good. Is it possible to make the attribute deletion function a utility that lives in deepspeed.utils?
@@ -519,6 +520,10 @@ def __init__(self, | |||
self._enable_universal_checkpoint() | |||
self._param_slice_mappings = self._create_param_mapping() | |||
|
|||
def destroy(self): |
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.
This is needed in the other optimizer implementations:
Create destroy function for zero stage 1 and 2, update the current function for zero 3. Add a destructor to the engine so that it releases memory at exit.