Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion megatron/optimizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,20 @@ def _get_params_for_weight_decay_optimization(modules):
[p for n, p in list(module_._parameters.items())
if p is not None and n == 'bias'])

return weight_decay_params, no_weight_decay_params
# XXX: temp hack to workaround the crash in apex FusedAdam's multi_tensor_applier
#
# it crashes when the param count is larger than a certain size which we hit at 200B over 80
# A100 gpus - I think around 2.7B per gpu, so halving it works around the issue
param_count = len(weight_decay_params['params'])
first_half = weight_decay_params['params'][:param_count // 2]
second_half = weight_decay_params['params'][param_count // 2:]

first_half = { 'params': first_half }
second_half = { 'params': second_half }

return first_half, second_half, no_weight_decay_params

#return weight_decay_params, no_weight_decay_params


def get_megatron_optimizer(model):
Expand Down