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] Deleting a key via CLI doesn't affect _self_ #2959

Open
2 tasks done
YodaEmbedding opened this issue Sep 19, 2024 · 0 comments
Open
2 tasks done

[Bug] Deleting a key via CLI doesn't affect _self_ #2959

YodaEmbedding opened this issue Sep 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@YodaEmbedding
Copy link

YodaEmbedding commented Sep 19, 2024

🐛 Bug

Description

Input:

# dataset/imagenet.yaml

path: "/datasets/imagenet"
type: "ImageNetDataset"
# example.yaml

defaults:
  - dataset/imagenet
  - _self_

dataset:
  type: "Overriden"
# main.py

import hydra
import yaml
from omegaconf import DictConfig, OmegaConf

@hydra.main(version_base=None, config_path="conf")
def main(conf: DictConfig):
    print(yaml.dump(OmegaConf.to_container(conf, resolve=True)))

if __name__ == "__main__":
    main()

[Case 1]

python main.py --config-path=conf --config-name=example '~dataset'

Output:

dataset:
  type: Overridden

It seems that _self_ is not processed in the same way as the defaults list.


[Case 2]

python simple.py --config-path=conf --config-name=example '~dataset' dataset=imagenet

Output:

dataset:
  type: Overridden

Checklist

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

To reproduce

See above.

Expected Behavior

[Case 1] Output:

dataset: {}

[Case 2] Output:

dataset:
  path: "/datasets/imagenet"
  type: "ImageNetDataset"

System information

  • Hydra Version : 1.3.2
  • Python version : 3.11.9
  • Virtual environment type and version : user
  • Operating system : MacOS

Additional context

@YodaEmbedding YodaEmbedding added the bug Something isn't working label Sep 19, 2024
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

1 participant