Skip to content
Open
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
28 changes: 18 additions & 10 deletions superbench/benchmarks/model_benchmarks/megatron_gpt3.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,23 @@ def __prepare_deespeed_config(self, precision_megatron):
"""Prepare deepspeed configs."""
self._config_json_path = os.path.join(self._args.data_home, 'ds_config_gpt.json')
# Load deepspeed config template json file
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "Load deepspeed config template json file", but this function is constructing the template dict inline (no JSON template is loaded). Updating/removing this comment would avoid confusion about where the config comes from.

Suggested change
# Load deepspeed config template json file
# Build deepspeed config template in memory

Copilot uses AI. Check for mistakes.
precision_template = {
'enabled': True,
'loss_scale': 0,
'loss_scale_window': 500,
'min_loss_scale': 1,
'initial_scale_power': 11
}
if self._args.hysteresis is not None:
precision_template['hysteresis'] = self._args.hysteresis
# FP16 supports loss scaling parameters; BF16 does not (sufficient dynamic range).
if precision_megatron == 'fp16':
precision_template = {
'enabled': True,
'loss_scale': 0,
'loss_scale_window': 500,
'min_loss_scale': 1,
'initial_scale_power': 11
}
if self._args.hysteresis is not None:
precision_template['hysteresis'] = self._args.hysteresis
elif precision_megatron == 'bf16':
precision_template = {
'enabled': True,
}
else:
precision_template = None

ds_config_template = {
'train_batch_size': self._args.batch_size,
Expand All @@ -328,7 +336,7 @@ def __prepare_deespeed_config(self, precision_megatron):
'prescale_gradients': self._args.prescale_grad,
}

if len(precision_megatron) > 0:
if precision_template is not None:
ds_config_template[precision_megatron] = precision_template

# Write to config json file
Expand Down
Loading