Skip to content

Fix checkpoint config.yaml resume merge and add --config launch flag#520

Open
eugenevinitsky wants to merge 2 commits into
3.0from
fix/config-yaml-reload
Open

Fix checkpoint config.yaml resume merge and add --config launch flag#520
eugenevinitsky wants to merge 2 commits into
3.0from
fix/config-yaml-reload

Conversation

@eugenevinitsky

Copy link
Copy Markdown

What

  • Fix the resume-time config.yaml merge in train(). It computed experiment_dir = dirname(load_model_path), but checkpoints live in <run>/models/ while config.yaml is written to <run>/, so the os.path.exists check always failed and the merge silently never ran. The block also carried a stale private copy of the architecture key list (missing all obs_norm_*/obs_range_* and waypoint keys). Both problems are fixed by deleting the block and routing train() through _merge_checkpoint_arch, which already uses the correct dirname(dirname(model_path)) layout and the canonical _ARCH_ENV_KEYS.
  • Print a notice instead of silently returning when _merge_checkpoint_arch finds no config.yaml, so a fall-back to ini/CLI policy/obs layout is visible in logs.
  • Add a first-class --config flag to load_config. It accepts both a run-dumped config.yaml (nested sections, including deep eval.*.* nesting) and a flat dotted cluster config (env.num_agents: 128), flattens it to dotted parser dests, validates every key against the registered argparse dests (unknown key -> ValueError naming it), and applies it via parser.set_defaults. Precedence: default.ini < drive.ini < --config < explicit CLI flags. Run-dump-only keys (git, train.use_rnn, config) are dropped.
  • New tests in tests/unit_tests/test_drive_config.py covering nested yaml load + CLI-flag precedence, flat dotted yaml load, and unknown-key rejection.

Why

Best models did not reproduce: resuming or fine-tuning from a checkpoint silently rebuilt the policy and observation layout from ini defaults because the config.yaml merge never fired, and there was no way to launch a run from a saved config file at all (run dumps, cluster configs, and CLI flags were three mutually incompatible formats). Typos in a config file must fail loudly rather than no-op.

Notes

  • Verification: pytest tests/unit_tests/test_drive_config.py -x -q -> 9 passed, 1 skipped; pytest tests/unit_tests -k "config or yaml" -q -> 12 passed, no regressions. End-to-end smoke: --config scripts/cluster_configs/nightly_best.yaml loads correctly through load_config (num_agents=4096, backbone_hidden_size=1024, wandb project/group, eval disables all applied). Missing-config notice verified on a nonexistent checkpoint path. ruff format --check clean; the 50 ruff check findings in pufferl.py are identical on the base commit (pre-existing).
  • Behavioral change: train --load-model-path now also adopts policy_name/rnn_name (and derived train.use_rnn) plus the full _ARCH_ENV_KEYS set from the checkpoint's config.yaml — previously it adopted nothing at all due to the path bug, so any resumed run that relied on CLI flags to re-specify the architecture will now get it from the checkpoint automatically (this is the intended semantics: the net must match the weights).
  • Risk: configs saved by older runs whose yaml contains keys since removed from drive.ini will now raise ValueError when passed via --config (fail-fast by design); remove the stale keys from the file to launch.
  • No merge-order dependencies; single self-contained commit based on origin/3.0.

🤖 Generated with Claude Code

🤖 Generated with Claude Code

Eugene Vinitsky and others added 2 commits July 10, 2026 11:03
The resume-time merge in train() looked for config.yaml next to the
checkpoint instead of one level up, so it never fired and resumed runs
silently rebuilt the policy from ini defaults; its key list had also
diverged from _ARCH_ENV_KEYS. Route train() through
_merge_checkpoint_arch (correct path, full key set) and print a notice
when config.yaml is absent. Add a first-class --config flag to
load_config that layers a yaml file (nested run dump or flat dotted
cluster config) between ini defaults and explicit CLI flags, rejecting
unknown keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant