Skip to content

Fix CLI config handling: --config on convert/generate, and missing config files - #46

Merged
niklashoelter merged 1 commit into
niklashoelter:masterfrom
avnoordenne:fix/cli-config-handling
Oct 18, 2026
Merged

niklashoelter merged 1 commit into
niklashoelter:masterfrom
avnoordenne:fix/cli-config-handling

Conversation

@avnoordenne

Copy link
Copy Markdown
Contributor

Problem

  • gpuma convert and gpuma generate reject --config with unrecognized arguments, although docs/cli.md shows --config on both. They can only read ./config.json from the working directory.
  • A --config path that does not exist is silently ignored. load_config_from_file falls back to the built-in defaults, so a typo in the path runs the default model (UMA uma-s-1p2). That run then fails on a missing Hugging Face token, or, if a token is set, runs a different model than the one in the intended config.
  • gpuma config --validate missing.json reports the file as valid.

Changes

  • convert and generate accept --config/-c, like the other commands.
  • An explicit --config path that does not exist is a usage error (argparse, exit code 2).
  • With no --config and no ./config.json, the CLI still runs on the defaults, but now logs a warning that names the default model.
  • config --validate on a missing file logs an error and exits 1.
  • docs/cli.md describes the missing-config behaviour and notes that global flags (--device, --model-type, --verbose, --quiet) go before the subcommand.

The check lives in the CLI (_resolve_config_path). load_config_from_file in the Python API still returns defaults for a missing file.

Behaviour change

A script that passes --config with a path that does not exist used to run on the defaults. It now stops with exit code 2. This affects only invocations whose config path is wrong.

Tests

New tests in tests/test_cli.py:

  • test_convert_and_generate_accept_config (both commands)
  • test_missing_explicit_config_is_a_usage_error
  • test_validate_rejects_a_missing_file
  • test_no_config_anywhere_reports_defaults

None of them need a GPU. tests/test_cli.py passes (28 passed, 1 skipped for HF_TOKEN), including the end-to-end ORB runs on GPU. The full suite passed on an earlier revision of this branch (316 passed, 14 skipped). The final revision only drops a separate charge/multiplicity change from cli.py and its tests.

- convert and generate rejected --config, although docs/cli.md shows it.
  Both now accept it.
- A --config path that does not exist is now a usage error instead of a
  silent fallback to the built-in defaults (UMA, which needs a token).
  With no --config and no ./config.json, the run continues on defaults
  and logs a warning naming the model. config --validate on a missing
  file exits 1.
@niklashoelter
niklashoelter merged commit 32504bd into niklashoelter:master Oct 18, 2026
1 check passed
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.

2 participants