Skip to content

Commit

Permalink
fix(hybrid optim): fp32_grad not scaled when use offload_cpu (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengsibo authored Jan 6, 2025
1 parent d03c6f9 commit 2874881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internlm/solver/optimizer/hybrid_zero_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,9 @@ def _step(self, closure=None, norms=None):
param_shape == flat_fp32_avg_grads.shape
), f"fp32 param and grad have different shape {param_shape} vs {flat_fp32_avg_grads.shape}"

single_grad_partition_groups.append(flat_fp32_avg_grads)
device = self._fp32_flat_param_groups_of_current_rank[group_id].device
self._fp32_flat_param_groups_of_current_rank[group_id].grad = flat_fp32_avg_grads.to(device)
single_grad_partition_groups.append(self._fp32_flat_param_groups_of_current_rank[group_id].grad)
# unscale and clip grads
# get the global norm
global_norm_groups = {}
Expand Down

0 comments on commit 2874881

Please sign in to comment.