-
-
Notifications
You must be signed in to change notification settings - Fork 773
Description
🐛 Bug
Description
When trying to modify a config group which is child of another config groups as well a child of another config group, the update is only possible by overriding the existing value (add a +).
It ends up with a mix of the existing and new values.
(I guess the example will make more sense than my explanation sorry)
Checklist
- I checked on the latest version of Hydra
- I created a minimal repro (See this for tips).
To reproduce
test_hydra2/config.yaml
defaults:
- level1: level11/level11_ini
- _self_
test_hydra2/config/level1/level11/level11_ini.yaml
defaults:
- /level1/level11/level111@subparams: level111_ini
- _self_
p1: 1
p2: 2
test_hydra2/config/level1/level11/level111/level111_ini.yaml
defaults:
- ../../level12@out: level12_ini
- _self_
test_hydra2/config/level1/level12/level12_ini.yaml
o1: 1
o2: 2
test_hydra2/config/level1/level12/level12_end.yaml
o1: 10
o2: 3
test_hydra2/main.py
import hydra
from omegaconf import DictConfig
@hydra.main(version_base=None, config_path="config/", config_name="config")
def run_test(cfg: DictConfig) -> None:
print(cfg)
if __name__ == "__main__":
run_test()
uv run python -m test_hydra2.main
{'level1': {'subparams': {'out': {'o1': 1, 'o2': 2}}, 'p1': 1, 'p2': 2}}
uv run python -m test_hydra2.main level1/[email protected]=level12_end
Could not override 'level1/[email protected]'. No match in the defaults list.
To append to your default list use +level1/[email protected]=level12_end
uv run python -m test_hydra2.main +level1/[email protected]=level12_end
{'level1': {'subparams': {'out': {'o1': 10, 'o2': 2, 'o3': 3}}, 'p1': 1, 'p2': 2}}
** Stack trace/error message **
Could not override 'level1/[email protected]'. No match in the defaults list.
To append to your default list use +level1/[email protected]=level12_end
Expected Behavior
{'level1': {'subparams': {'out': {'o1': 10, 'o3': 3}}, 'p1': 1, 'p2': 2}}
System information
- Hydra Version : 1.3.2
- Python version : 3.13.3
- Virtual environment type and version : uv 0.9.18
- Operating system : Ubuntu 24.04
Additional context
Add any other context about the problem here.
The way to fix is to use the complete path for the out param
test_hydra2/config/level1/level11/level111/level111_ini.yaml
defaults:
- /level1/level12@out: level12_ini
- _self_