Skip to content

Standardize CLI flags on underscore spellings#507

Closed
eugenevinitsky wants to merge 8 commits into
3.0from
ev/accept-underscore-cli-flags
Closed

Standardize CLI flags on underscore spellings#507
eugenevinitsky wants to merge 8 commits into
3.0from
ev/accept-underscore-cli-flags

Conversation

@eugenevinitsky

@eugenevinitsky eugenevinitsky commented Jul 3, 2026

Copy link
Copy Markdown

What

Standardizes the entire repo's CLI on underscore-style flags — the same spelling as the config keys they mirror:

  • puffer CLI: config-derived flags are now registered verbatim as their drive.ini/default.ini keys (the fmt.replace("_", "-") conversion is gone), so --env.num_agents is the flag, the argparse dest, the ini key, and the wandb key — no translation layer anywhere. Hand-registered flags (--load_model_path, --num_scenarios, --render_mode, --wandb_project, …) match.
  • Internal command builders updated in lockstep: manager.py subprocess-eval commands, utils.py's visualize argv (+ visualize.c's parser), submit_cluster.py's --args key=value pass-through (which previously converted underscores to dashes).
  • Script interfaces: submit_cluster.py (--save_dir, --compute_config, …), run_all_eval.sh, run_all_latest_eval.py, render_scenario.py, drive.py --data_dir.
  • Docs: README, AGENTS.md, CLAUDE.md, docs/cluster_training.md, docs/evaluation.md, benchmark README.

Exceptions (external conventions, unchanged): torchrun's --nproc-per-node/--rdzv-*, sbatch/pip/nvidia-smi/git flags, and --local-rank (injected by torch launchers).

Why

argparse matches flag spellings literally, and the repo mixed two conventions: config-derived flags were dash-converted at registration while other flags (and all the cluster scripts) used underscores. The natural workflow — copy a key from drive.ini and type --env.num_agents — failed with unrecognized arguments; the README's own examples had it wrong, and main() had grown a dual-spelling workaround for a few eval flags. Registering flags verbatim as their config keys removes the footgun at its source: one spelling, zero conversions.

Notes

  • Verified: underscore spellings parse through load_config (top-level, dotted, multi-value, =value form); dash spellings are rejected with a clear argparse error; submit_cluster.py --dry works; end-to-end CPU training with underscore flags runs to a checkpoint.
  • Swept the repo: the only remaining dash-style flags belong to external tools, plus the documented --local-rank exception.
  • Two pre-existing breakages found during verification (not fixed here): run_failure_scenarios.py:65 passes --map_indices, a flag that doesn't exist anywhere in pufferlib; and visualize.c doesn't compile against current drive.h (missing goal_behavior/puffers fields) — its flag strings were updated for consistency but the binary was already unbuildable.
  • Heads-up for WIP: Fix setup instructions and symlink-cycle compile hang #506: its README/docs edits convert examples to dash spellings, which this PR makes wrong. Whichever merges second needs the doc examples reconciled to underscores — happy to update WIP: Fix setup instructions and symlink-cycle compile hang #506 once this lands.

🤖 Generated with Claude Code

Eugene Vinitsky and others added 5 commits July 3, 2026 16:31
Config-derived flags are registered dash-style only, so the natural
--env.num_agents spelling was rejected with 'unrecognized arguments'
while hand-registered top-level flags (--num_scenarios) require
underscores. Normalize underscore spellings to their registered dash
form at parse time; flags registered with underscores are untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A few top-level flags are registered with underscores (--num_scenarios,
--agent_index, --eval_simulation) while everything else is dash-style.
Rewrite unregistered tokens to whichever form the parser knows, so both
spellings work for every flag in both directions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
--num_scenarios, --agent_index, and --eval_simulation were the only
flags registered with underscores; register them dash-style like every
other flag and update docs/help text. Old underscore spellings keep
working: main()'s eval-flag scan already accepts both, and
normalize_flag_dashes rewrites the rest at parse time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop the underscore-spelling normalization and the dual-spelling
entries in main()'s eval-flag scan. --num_scenarios, --agent_index,
and --eval_simulation were the last underscore registrations; every
flag is now dash-style and underscore spellings are rejected. Update
the eval scripts that forwarded underscore spellings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eugenevinitsky eugenevinitsky changed the title Accept underscore spellings for config-derived CLI flags Standardize CLI flags on dash spellings Jul 3, 2026
Eugene Vinitsky and others added 3 commits July 3, 2026 16:53
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
submit_cluster.py (--save-dir, --compute-config, --program-config,
--gpu-type, --task-per-node, --max-pjob, --container-image,
--container-overlay) and drive.py's --data-dir, plus every caller and
doc reference. argparse dests are unchanged. torchrun's
--nproc_per_node is external and stays as is.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Register config-derived flags verbatim as their ini keys (drop the
underscore-to-dash conversion) so flag == config key == dest == wandb
key with no translation layer anywhere. Convert all hand-registered
flags, script interfaces, internal command builders (manager.py
subprocess eval, utils.py visualize argv, submit_cluster --args), and
docs to match. External tool flags (torchrun --nproc-per-node/--rdzv-*,
sbatch, pip, nvidia-smi, git) and --local-rank (torch launcher
convention) keep their native spellings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eugenevinitsky eugenevinitsky changed the title Standardize CLI flags on dash spellings Standardize CLI flags on underscore spellings Jul 3, 2026
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