mirror of
https://github.com/deepspeedai/DeepSpeed.git
synced 2025-10-20 15:33:51 +08:00
Make sure it's not None before offloading contiguous_grad_buffer (#7227)
Resolves #7223
When DeepCompile is enabled in ZeRO-3, contiguous_grad_buffer is
released, so we should check and make sure it's not None before we
continue.
227a60c0c4/deepspeed/compile/init_z3.py (L22-L25)
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Co-authored-by: Masahiro Tanaka <81312776+tohtana@users.noreply.github.com>
This commit is contained in:
@ -2915,7 +2915,8 @@ class DeepSpeedZeroOptimizer_Stage3(ZeROOptimizer):
|
||||
|
||||
# contiguous bucket
|
||||
if needs_offload(OffloadStateTypeEnum.contiguous_grad_buffer):
|
||||
if hasattr(self, "_DeepSpeedZeroOptimizer_Stage3__ipg_bucket_flat_buffer"):
|
||||
if hasattr(self, "_DeepSpeedZeroOptimizer_Stage3__ipg_bucket_flat_buffer"
|
||||
) and self.__ipg_bucket_flat_buffer is not None:
|
||||
# Record properties like shape, strides, etc. as a meta tensor
|
||||
self.grad_buffer_meta = self.__ipg_bucket_flat_buffer.to("meta")
|
||||
self.__ipg_bucket_flat_buffer = None
|
||||
|
Reference in New Issue
Block a user