Skip to content

Commit

Permalink
update cpu adam fp16 case
Browse files Browse the repository at this point in the history
  • Loading branch information
Fridge003 committed Oct 17, 2023
1 parent c7a6004 commit ebc9e52
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion colossalai/zero/gemini/gemini_ddp.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def grad_handle(self, p, grad):
if chunk.l2_norm_flag:
grad_chunk.set_l2_norm()
self.chunk_manager.move_chunk(grad_chunk, self.grads_device[p], force_copy=True)
if not self.master_weights:
if not (self.master_weights) or (self.enable_gradient_accumulation):
self.chunk_manager.move_chunk(chunk, self.grads_device[p], force_copy=True)
return empty_grad

Expand Down
4 changes: 0 additions & 4 deletions tests/test_zero/test_gemini/test_grad_accum.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ def exam_gemini_grad_acc(
check_grad(gemini_model, torch_model)

if (i + 1) % accum_iter == 0:
# TODO(Baizhou): Delete following two lines after cpu_adam for fp16 has been merged into main branch (auto policy put gradients in cpu).
if placement_config["placement_policy"] == "auto":
break

torch_optim.step()
gemini_optim.step()
torch_optim.zero_grad()
Expand Down

0 comments on commit ebc9e52

Please sign in to comment.