Skip to content

Commit

Permalink
pipe/_exec_backward_pass: fix immediate grad update (microsoft#5605)
Browse files Browse the repository at this point in the history
dont call update_hp_grads in _exec_backward_pass incase of immediate
grad update, as it would be called as part of bwd hooks
  • Loading branch information
nelyahu authored Jun 12, 2024
1 parent ac935c7 commit 91a9986
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deepspeed/runtime/pipe/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ def _exec_backward_pass(self, buffer_id):

if self.using_bf16_optimizer and not self.is_last_stage():
# manually call because we don't call optimizer.backward()
self.optimizer.update_hp_grads(clear_lp_grads=False)
if not self._config.bfloat16_immediate_grad_update:
self.optimizer.update_hp_grads(clear_lp_grads=False)

# Free up the memory from the output of forward()
self.pipe_buffers['output_tensors'][buffer_id] = None
Expand Down

0 comments on commit 91a9986

Please sign in to comment.