Replies: 3 comments 3 replies
-
The implementation looks good. def get_leaves_str(cfg, parent=None):
if not OmegaConf.is_config(cfg):
assert parent, cfg
return [f"{parent} = {str(cfg)}"]
if OmegaConf.is_list(cfg):
keys = range(len(cfg))
elif OmegaConf.is_config(cfg):
keys = cfg.keys()
else:
raise NotImplementedError
string = []
parent = f"{parent}." if parent else ""
for k in keys:
child_key = f"{parent}{k}"
if OmegaConf.is_missing(cfg, k):
string += [f"{child_key} = ???"]
else:
v = cfg[k]
string += get_leaves_str(v, child_key)
return string |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, would you consider adding this |
Beta Was this translation helpful? Give feedback.
0 replies
-
hi @songyuc - pls open a feature request as an separate issue :) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the solution you'd like
I want to print all the leave values of an OmegaConf object, so that I can check them directly.
Describe alternatives you've considered
I have implemented it as:
Additional context
Do you think it could be improved? Please share me some guide and advice.
Beta Was this translation helpful? Give feedback.
All reactions