-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix param.ds_id not found bug when call 'deepspeed.runtime.swap_tensor.optimizer_utils.OptimizerSwapper._create_param_swap_info #5193
Closed
Conversation
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
…r.optimizer_utils.OptimizerSwapper._create_param_swap_info' method under optimizer offload condition. Detail desc: In new version of Deepspeed(0.1.3.3), the deepspeed.runtime.swap_tensor.optimizer_utils.OptimizerSwapper has added 'parameter_id(param)' method to get param id, while in older version like 0.12.4 the origin method is 'id(param)'. Hower in deepspeed.runtime.zero.stage3.DeepSpeedZeroOptimizer_Stage3._create_fp32_partitions method, the 'self.optimizer_swapper.initialize_paraeters(parameters=[self.fp32_partitioned_groups_flat[i]], src_tensors=[unpinned_fp32_buffer])' method will use unpinned_fp32_buffer without ds_id under optimizer offload condition
…r.optimizer_utils.OptimizerSwapper._create_param_swap_info' method under optimizer offload condition. Detail desc: In new version of Deepspeed(0.1.3.3), the deepspeed.runtime.swap_tensor.optimizer_utils.OptimizerSwapper has added 'parameter_id(param)' method to get param id, while in older version like 0.12.4 the origin method is 'id(param)'. Hower in deepspeed.runtime.zero.stage3.DeepSpeedZeroOptimizer_Stage3._create_fp32_partitions method, the 'self.optimizer_swapper.initialize_paraeters(parameters=[self.fp32_partitioned_groups_flat[i]], src_tensors=[unpinned_fp32_buffer])' method will use unpinned_fp32_buffer without ds_id under optimizer offload condition
tjruwase
reviewed
Jun 26, 2024
@@ -840,6 +843,7 @@ def _create_fp32_partitions(self): | |||
else: | |||
unpinned_fp32_buffer = torch.empty(num_elements, device=self.device, dtype=torch.float) | |||
self._swap_in_sub_group_to_flat_buffer(unpinned_fp32_buffer, i) | |||
self.fp32_partitioned_groups_flat[i].ds_id = ds_id |
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.
There is currently redundancy between L846 and L872. To fix this, how about move L846 to after L831 for the if ...
and move L846 into the else ...
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 14, 2024
Fix #5495 - Fix missing ds_id bug by copying solution from #5193 (credit to @getinglxf) Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
Closing due to fix being applied in #5824 |
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.
Fix param.ds_id not found bug when call 'deepspeed.runtime.swap_tensor.optimizer_utils.OptimizerSwapper._create_param_swap_info' method under condition
that 'offload_optimizer' and 'offload_param' set to nvme path in zero_config.
In new version of Deepspeed(0.13.3), the deepspeed.runtime.swap_tensor.optimizer_utils.OptimizerSwapper has added 'parameter_id(param)' method to get param id, while in older version like 0.12.4 the origin method is 'id(param)'. This change causes a new bug: when call deepspeed.runtime.zero.stage3.DeepSpeedZeroOptimizer_Stage3._create_fp32_partitions method in init process,the 'self.optimizer_swapper.initialize_paraeters(parameters=[self.fp32_partitioned_groups_flat[i]], src_tensors=[unpinned_fp32_buffer])' method will use unpinned_fp32_buffer without ds_id under optimizer offload condition, which will throw a error : "AttributeError: 'Tensor' object has no attribute 'ds_id'"