Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhball committed Feb 7, 2023
1 parent 8bbd3a1 commit 1e5740f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions hydra/_internal/instantiate/_instantiate2.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,18 +354,20 @@ def instantiate_node(
):
dict_items = {}
for key, value in node.items():
# list items inherits recursive flag from the containing dict.
dict_items[key] = instantiate_node(
value, convert=convert, recursive=recursive
)
if recursive:
# list items inherits recursive flag from the containing dict.
dict_items[key] = instantiate_node(
value, convert=convert, recursive=recursive
)
return dict_items
else:
# Otherwise use DictConfig and resolve interpolations lazily.
cfg = OmegaConf.create({}, flags={"allow_objects": True})
for key, value in node.items():
cfg[key] = instantiate_node(
value, convert=convert, recursive=recursive
)
if recursive:
cfg[key] = instantiate_node(
value, convert=convert, recursive=recursive
)
cfg._set_parent(node)
cfg._metadata.object_type = node._metadata.object_type
if convert == ConvertMode.OBJECT:
Expand Down

0 comments on commit 1e5740f

Please sign in to comment.