in training/utils/train_utils.py [0:0]
def collect_dict_keys(config):
"""This function recursively iterates through a dataset configuration, and collect all the dict_key that are defined"""
val_keys = []
# If the this config points to the collate function, then it has a key
if "_target_" in config and re.match(r".*collate_fn.*", config["_target_"]):
val_keys.append(config["dict_key"])
else:
# Recursively proceed
for v in config.values():
if isinstance(v, type(config)):
val_keys.extend(collect_dict_keys(v))
elif isinstance(v, omegaconf.listconfig.ListConfig):
for item in v:
if isinstance(item, type(config)):
val_keys.extend(collect_dict_keys(item))
return val_keys