Skip to content

feat(training): add --config-path to config validate and unify config composition#1216

Open
frazane wants to merge 2 commits into
mainfrom
feat/config-validate-config-path
Open

feat(training): add --config-path to config validate and unify config composition#1216
frazane wants to merge 2 commits into
mainfrom
feat/config-validate-config-path

Conversation

@frazane

@frazane frazane commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Add --config-path/-i to anemoi-training config validate so a config living in any directory can be validated without first cd-ing into it, and route both config validate and config dump through a single Hydra-composition helper. This brings validate in line with train (which honours Hydra's --config-path) and dump (which already exposes --config-path/-i). Closes #1184.

What problem does this change solve?

A new, backward-compatible feature plus an internal cleanup.

validate was the only config-consuming subcommand with no way to say where the config lives: it exposed only --config-name, --overwrite and --mask_env_vars, and composed with an empty primary path (initialize(version_base=None, config_path="")), so a config was reachable only through AnemoiSearchPathPlugin — the current working directory and the packaged defaults. Validating a config anywhere else meant changing directory first.

When --config-path is given, the config is now composed from that directory via Hydra's initialize_config_dir, which installs it as the primary (main) search-path entry — the same precedence @hydra.main gives train's --config-path: --config-path > current working directory > packaged defaults (the model #1181 established). When it is omitted, behaviour is unchanged, and the misleading config_path="" (which did no useful work) is dropped.

anemoi-training config validate --config-path /path/to/configs --config-name debug.yaml

What issue or task does this change relate to?

Closes #1184. Follows #1181, which made the user-specified --config-path take precedence and simplified the search-path hierarchy for train.

Additional notes

validate and dump now share one composition helper — initialize_config_dir(dir) when a --config-path is given, plain initialize() otherwise. This replaces dump's previous approach of copying the directory's files into a temporary directory and chdir-ing into it, a workaround that existed only because Hydra's initialize resolves config_path relative to the calling module and so cannot take an arbitrary user directory. dump's observable behaviour is unchanged — it still composes the named config from the given directory, or from the working directory and packaged defaults when none is given — but it no longer copies files or mutates the process working directory.

Tests: tests/unit/commands/test_config.py covers validate composing a config discovered only via --config-path, and dump composing from a --config-path directory. Docs: a note and example were added to docs/user-guide/configuring.rst.

This change was developed in tandem with AI coding agents.


As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/

By opening this pull request, I affirm that all authors agree to the Contributor License Agreement.


📚 Documentation preview 📚: https://anemoi-training--1216.org.readthedocs.build/en/1216/


📚 Documentation preview 📚: https://anemoi-graphs--1216.org.readthedocs.build/en/1216/


📚 Documentation preview 📚: https://anemoi-models--1216.org.readthedocs.build/en/1216/

@github-project-automation github-project-automation Bot moved this to To be triaged in Anemoi-dev Jun 26, 2026
@frazane frazane added the ATS Approval Not Needed No approval needed by ATS label Jun 26, 2026
@frazane frazane self-assigned this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ATS Approval Not Needed No approval needed by ATS training

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

anemoi-training config validate has no --config-path, unlike config dump and train

1 participant