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

Resolve Hydra ListConfig objects #612

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion configs/experiment/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ defaults:
# all parameters below will be merged with parameters from default configurations set above
# this allows you to overwrite only specified parameters

tags: ["mnist", "simple_dense_net"]
# `tags` is a list of strings, defined either:
# 1. In JSON flow-style: ["mnist", "simple_dense_net", ...]
# 2. As a YAML block-style array, as shown below.
# Tags can be interpolated dynamically at runtime.
# NOTE: Dynamic interpolation is only supported in block-style lists, not flow-style.
tags:
- "mnist"
- "simple_dense_net"
- ${task_name} # will be dynamically interpolated
- batch_size_${data.batch_size} # will also be dynamically interpolated

seed: 12345

Expand Down
4 changes: 2 additions & 2 deletions src/utils/rich_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import rich.tree
from hydra.core.hydra_config import HydraConfig
from lightning_utilities.core.rank_zero import rank_zero_only
from omegaconf import DictConfig, OmegaConf, open_dict
from omegaconf import DictConfig, ListConfig, OmegaConf, open_dict
from rich.prompt import Prompt

from src.utils import pylogger
Expand Down Expand Up @@ -58,7 +58,7 @@ def print_config_tree(
branch = tree.add(field, style=style, guide_style=style)

config_group = cfg[field]
if isinstance(config_group, DictConfig):
if isinstance(config_group, (DictConfig, ListConfig)):
branch_content = OmegaConf.to_yaml(config_group, resolve=resolve)
else:
branch_content = str(config_group)
Expand Down
Loading