Pipeline engine overrides deepspeed.runtime.engine.is_gradient_accumulation_boundary()
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/pipe/engine.py#L560
In this implementation is_gradient_accumulation_boundary will return True only when the pipe is executing _exec_optimizer_step or _exec_reduce_grads. It will return False during forward and backward calls. Additionally it will ignore calls to set_gradient_accumulation_boundary.
This behavior leads to multiple issue in deepspeed.runtine.engine.backward
-
loss list grows indefinitely
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1884
-
If zero is enabled optimizer is called with incorrect state of is_gradient_accumulation_boundary
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1894
-
amp loss scaling incorrect.
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1899C13-L1899C27
Pipeline engine overrides deepspeed.runtime.engine.is_gradient_accumulation_boundary()
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/pipe/engine.py#L560
In this implementation is_gradient_accumulation_boundary will return True only when the pipe is executing _exec_optimizer_step or _exec_reduce_grads. It will return False during forward and backward calls. Additionally it will ignore calls to set_gradient_accumulation_boundary.
This behavior leads to multiple issue in deepspeed.runtine.engine.backward
loss list grows indefinitely
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1884
If zero is enabled optimizer is called with incorrect state of is_gradient_accumulation_boundary
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1894
amp loss scaling incorrect.
https://github.com/microsoft/DeepSpeed/blob/7e8bcc07d6532a380a7a439741609b058f083ed6/deepspeed/runtime/engine.py#L1899C13-L1899C27