I'm working through this Hydra doc example to override the main config with an experiment config. I'm trying to override main
with experiment
and I'm not sure where I'm going wrong.
The error I get is:
Exception has occurred: ConstructorError
while constructing a mapping
in "/home/ghb/projects/aisc/embeddings_and_difficulty/configs_hydra/experiment/experiment.yaml", line 2, column 1
found duplicate key main
in "/home/ghb/projects/aisc/embeddings_and_difficulty/configs_hydra/experiment/experiment.yaml", line 9, column 1
File "/home/ghb/projects/aisc/embeddings_and_difficulty/runner.py", line 70, in <module>
main()
yaml.constructor.ConstructorError: while constructing a mapping
in "/home/ghb/projects/aisc/embeddings_and_difficulty/configs_hydra/experiment/experiment.yaml", line 2, column 1
found duplicate key main
in "/home/ghb/projects/aisc/embeddings_and_difficulty/configs_hydra/experiment/experiment.yaml", line 9, column 1
Folder structure:
configs
|--- experiment
|--- experiment.yaml
|--- main
|--- general.yaml
|--- debug.yaml
config.yaml
My config.yaml
:
defaults:
- main: general
- experiment: experiment
My experiment.yaml
:
# @package _global_
defaults:
- override /main: debug
main:
TRAINING:
BACKBONE:
MAX_EPOCH: 20
My general.yaml
:
main:
TRAINING:
BACKBONE:
MAX_EPOCH: 200
My debug.yaml
:
main:
TRAINING:
BACKBONE:
MAX_EPOCH: 2
This error normally appears when Hydra loads a YAML file with a duplicate key. I this case configs_hydra/experiment/experiment.yaml
.
The file content you provided here does not have a duplicate main
key, but I suspect your actual file does.
If it doesn't, please provide a zip file with a minimal repro.