Skip to content

Fix launch_alpamayo_model docstring: ckpt source is --config arg, not env var#98

Open
lonexreb wants to merge 1 commit intoNVlabs:mainfrom
lonexreb:docs/launcher-fix-cosmos-config-source
Open

Fix launch_alpamayo_model docstring: ckpt source is --config arg, not env var#98
lonexreb wants to merge 1 commit intoNVlabs:mainfrom
lonexreb:docs/launcher-fix-cosmos-config-source

Conversation

@lonexreb
Copy link
Copy Markdown
Contributor

@lonexreb lonexreb commented May 4, 2026

Problem

launch_alpamayo_model in finetune/rl/launcher.py documents the fallback for ckpt_path=None as:

ckpt_path: Checkpoint path for data/tokenizer init.  If ``None``,
    reads ``[policy].model_name_or_path`` from the TOML config
    pointed to by the ``COSMOS_CONFIG`` env var.

But the actual implementation in _read_ckpt_path_from_toml (same file, lines 21–42) does no such thing — it scans sys.argv for the literal --config <path> argument pair that the Cosmos launch_replica.sh wrapper passes:

for i, arg in enumerate(sys.argv):
    if arg == "--config" and i + 1 < len(sys.argv):
        toml_path = sys.argv[i + 1]
        break

if not toml_path:
    raise RuntimeError(
        "No --config <path> found in sys.argv. "
        "The Cosmos orchestrator should pass --config automatically."
    )

There is no os.environ lookup anywhere in the file — COSMOS_CONFIG isn't read at all. A user trying to set COSMOS_CONFIG=/path/to.toml and call launch_alpamayo_model(spec) would hit the RuntimeError("No --config <path> found in sys.argv") instead.

Fix

Pure docs change. No runtime behavior change.

  • Describe the actual source (--config <path> in sys.argv, set by launch_replica.sh).
  • Cross-reference _read_ckpt_path_from_toml so the docstring stays anchored to the implementation.
  • Drop a stray double space before "If".

Verification

grep -n COSMOS_CONFIG finetune/rl/launcher.py returns nothing after this PR — confirming the env var was never read.

… env var

`launch_alpamayo_model` documents the fallback for `ckpt_path=None` as:

    reads [policy].model_name_or_path from the TOML config
    pointed to by the COSMOS_CONFIG env var.

But the actual implementation in `_read_ckpt_path_from_toml` (same file,
lines 21-42) does no such thing -- it scans `sys.argv` for the literal
`--config <path>` argument pair that the Cosmos `launch_replica.sh`
wrapper passes:

    for i, arg in enumerate(sys.argv):
        if arg == "--config" and i + 1 < len(sys.argv):
            toml_path = sys.argv[i + 1]
            break

There is no `os.environ` lookup in the file at all -- `COSMOS_CONFIG`
isn't read anywhere. A user trying to set `COSMOS_CONFIG=/path/to.toml`
and then call `launch_alpamayo_model(spec)` would hit the
`RuntimeError("No --config <path> found in sys.argv")` instead.

Fix the docstring to describe the actual source (`--config <path>` in
sys.argv, set by `launch_replica.sh`) and cross-reference the helper
that does the parsing. Also drop a stray double-space before "If".

Pure docs change. No runtime behavior change.

Signed-off-by: lonexreb <[email protected]>
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