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
4 changes: 3 additions & 1 deletion modelopt/torch/opt/plugins/mcore_dist_checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ def _parse_transformer_config(transformer_config: dict) -> dict:

if dist.is_master():
run_config_name = f"{checkpoint_name}/modelopt_run_config.yaml"
config_dict = _parse_transformer_config(copy.deepcopy(model[0].config.__dict__))
# We avoid deepcopy here since some attributes in Megatron-Bridge config cannot be
# deepcopy.
config_dict = _parse_transformer_config(model[0].config.__dict__)

Choose a reason for hiding this comment

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

n00b question: what's the reason to save this at all? wouldn't it be redundant with the existing MLM args saved in the checkpoint? will there also be a read API that reloads from this?

i ask because _parse_transformer_config is very simple but doesn't handle enums/lambdas/functional inputs in the dataclass for restoring as is done here: https://github.com/NVIDIA-NeMo/Megatron-Bridge/blob/main/src/megatron/bridge/utils/yaml_utils.py

config_dict["nvidia_modelopt_version"] = modelopt.__version__
with open(run_config_name, "w") as f:
yaml.dump(config_dict, f, default_flow_style=False)
Expand Down
Loading