Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Child defaults list with interpolation fails with a constructed path with too many group names #3036

Open
2 tasks done
shfattig opened this issue Feb 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@shfattig
Copy link

🐛 Bug

Description

A defaults list one level down that points to another defaults list with interpolation is prepending the path with group name too many times.

Checklist

  • I checked on the latest version of Hydra
  • I created a minimal repro (See this for tips).

To reproduce

files:

configs/
  default_config.yaml
  experiment/
    default.yaml
    exp1.yaml
    parameter1.yaml
  setting/
    parameter1.yaml

default_config.yaml

defaults:
  - group: specific
  - setting: parameter1

experiment/exp1.yaml

defaults:
  - default

experiment/default.yaml

defaults:
  - ${setting}

This setup attempts to provide some default configuration for an experiment given some setting. You can imagine if setting=parameter1, the experiment should include some specific config items. And if you're running the same experiment with setting=parameter2, a different set of config values should be used.

** Stack trace/error message **
hydra.errors.MissingConfigException: In 'experiment/default': Could not load 'experiment/experiment/parameter1'.

Expected Behavior

I expect ${setting} to resolve to experiment/parameter1, but there are instead two "experiment" folders prepended to the path

System information

  • Hydra Version : 1.3.0
  • Python version : 3.9
  • Virtual environment type and version :
  • Operating system : Linux

Additional context

Did some digging, it looks like the path for the node is getting prepended at interpolation resolution and then again prepended when calling get_config_path() before attempting to load the config

@shfattig shfattig added the bug Something isn't working label Feb 27, 2025
@AaronYoung5
Copy link

Btw not a fix for the bug (not sure if it's a bug or actually intended), but a workaround is by doing the following in experiment/default.yaml:

defaults:
  - /${setting}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants