Skip to content

Commit

Permalink
Merge branch 'main' of ssh://gitlab-master.nvidia.com:12051/ADLR/mega…
Browse files Browse the repository at this point in the history
…tron-lm into moe-tests
  • Loading branch information
wdykas committed Oct 5, 2023
2 parents be6f63e + 4e79e71 commit e1e6926
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions megatron/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ def calc_params_l2_norm(model):
params_data = []
for model_ in model:
for param in model_.parameters():
is_not_tp_duplicate = param_is_not_tensor_parallel_duplicate(param)
if args.expert_parallel and mpu.get_data_parallel_rank() > 0:
if not getattr(param, 'allreduce', True):
if not getattr(param, 'allreduce', True) and is_not_tp_duplicate:
assert param_is_not_shared(param)
assert param_is_not_tensor_parallel_duplicate(param)
params_data.append(param.data.float() if args.bf16 else param.data)
else:
is_not_shared = param_is_not_shared(param)
is_not_tp_duplicate = param_is_not_tensor_parallel_duplicate(param)
if is_not_shared and is_not_tp_duplicate:
params_data.append(param.data.float() if args.bf16 else param.data)

Expand Down

0 comments on commit e1e6926

Please sign in to comment.