NVIDIA / NVIDIA/Megatron-LM

Save PretrainConfigContainer as run_config.yaml in checkpoints

Open
#6,002 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
17.9k
Forks
4.5k
Avg merge
4d 6h
Merged PRs (30d)
271

Description

Parent initiative: #2319

## Context

Megatron-Bridge saves its configuration as `run_config.yaml`. Megatron-LM currently stores configuration in legacy checkpoint metadata under `state_dict["args"]`.

To align the checkpoint metadata, Megatron-LM must serialize its active `PretrainConfigContainer` as `run_config.yaml`. The legacy metadata must remain available during the compatibility period.

## Scope

- Add YAML serialization for `PretrainConfigContainer`.
- Write the active configuration to `run_config.yaml` in the checkpoint iteration directory.
- Cover all applicable distributed checkpoint save paths.
- Keep the existing `state_dict["args"]` metadata unchanged.
- Do not change the distributed checkpoint representation for model or optimizer state.

## Completion criteria

- Saving a checkpoint with an active `PretrainConfigContainer` writes `run_config.yaml`.
- Tests cover the YAML contents and the applicable checkpoint save paths.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the checkpoint save paths that handle an active PretrainConfigContainer, including the distributed checkpoint paths. Inspect how the container can be serialized and how the iteration directory is written. Add coverage for the YAML contents and each applicable save path, while confirming state_dict["args"] and model or optimizer representations remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.