Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Destroy ZeRO #4383

wants to merge 8 commits into from

Conversation

jomayeri
Copy link
Contributor

@jomayeri jomayeri commented Sep 21, 2023

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.

@@ -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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@tjruwase tjruwase Sep 22, 2023

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?

@jomayeri jomayeri requested a review from awan-10 as a code owner September 22, 2023 20:35
@@ -519,6 +520,10 @@ def __init__(self,
self._enable_universal_checkpoint()
self._param_slice_mappings = self._create_param_mapping()

def destroy(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants