facebookresearch / hydra

Hydra is a framework for elegantly configuring complex applications
https://hydra.cc
MIT License
8.84k stars 637 forks source link

[Bug] Misleading overriding behavior for "empty" (null) keys #2958

Open YodaEmbedding opened 2 months ago

YodaEmbedding commented 2 months ago

🐛 Bug

Description

Input:

# dataset/imagenet.yaml

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

defaults:
  - dataset/imagenet
  - _self_

dataset:
  type: "Overriden"

Output (as expected):

dataset:
  type: 'Overriden'
  path: '/datasets/imagenet'

However, if we change example.yaml to:

# example.yaml

defaults:
  - dataset/imagenet
  - _self_

dataset:

Output (unexpected, but correct):

dataset: null

The intuitive expected output would have been:

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

Checklist

To reproduce

See above.

Expected Behavior

When overriding existing dicts with a single null value, hydra could perhaps produce a warning.

System information

Additional context