Skip to content

Load run_sim arguments from a YAML/JSON document with --config - #306

Draft
Mark2000 wants to merge 1 commit into
mainfrom
run-config-document
Draft

Mark2000 wants to merge 1 commit into
mainfrom
run-config-document

Conversation

@Mark2000

Copy link
Copy Markdown
Collaborator

What

python -m holosoma.run_sim --config run.yaml reads its arguments from a versioned YAML/JSON document instead of a long command line:

version: 2
backend: mujoco                 # -> simulator:mujoco
arguments:
  robot: g1-29dof               # robot:g1-29dof
  sensor: {scan: g1-pelvis-lidar}   # sensor.scan:g1-pelvis-lidar
  overrides:
    training.headless: true     # --training.headless True
    robot.init_state.pos: [0.0, 0.0, 0.8]
  • Each entry expands to the CLI token you would otherwise type, so presets from installed extensions and --import-file work unchanged.
  • Command-line tokens win: a group the CLI selects replaces the document's, and repeated flags take the last value. Group selections are emitted before all flags, because tyro rejects a subcommand that follows a flag inside the default it replaces.
  • A document can be embedded in a larger file: under a holosoma_sim key (picked up automatically when the root has no version), or anywhere via --config-path a.b.
  • Only version, backend and arguments are accepted. Settings for other tools (container, middleware, display) go beside the document rather than inside it, and an unknown key is an error that names it.

Docs: docs/run-sim-config-files.md.

Scope

Only run_sim. train_agent/replay need their root exp: token first, and eval_agent pre-parses its args with two tyro.cli passes, so supporting those would need more than this expansion step. That can follow if someone needs it.

Testing

  • holosoma/utils/tests/test_config_document.py: a document (root, embedded, --config-path) parses to the same RunSimConfig as the equivalent CLI; CLI precedence for groups and flags; rejection of old versions, foreign fields, and backend together with arguments.simulator.
  • python -m holosoma.run_sim --config on a headless MuJoCo G1 document starts and runs at ~1.0x real time.
  • A larger document (Isaac Sim, 6 sensors, 12 plugins, 40 overrides) expands to the same tokens as an existing external converter for the same format.
  • pre-commit run on the changed files and mypy . pass.

🤖 Generated with Claude Code

`python -m holosoma.run_sim --config run.yaml` expands a versioned document into
the same CLI tokens a user would type: `arguments` groups become
`<group>:<preset>`, keyed mappings become `<family>.<key>:<preset>`, and
`overrides` become `--<dotted.path> <value>` flags. `backend` selects the
simulator. Command-line tokens take precedence: a group the CLI selects replaces
the document's, and repeated flags take the last value. Group selections are
emitted before flags so tyro sees each subcommand before the flags inside it.

A document may be embedded in a larger file, either under a `holosoma_sim` key
(picked up automatically when the root has no `version`) or anywhere selected
with `--config-path a.b`. Only `version`, `backend` and `arguments` are
accepted, so settings for other tools live beside the document, not in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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