Open timruhkopf opened 2 years ago
While not neat in the sence of supporting all recursive cases, the following method at least supports the cases, where the final node is a list
def _diff_overrides(self, run_info: RunInfo):
run_info_cfg_flat = flatten_dict(run_info.config.get_dictionary())
diff_overrides = []
for key, val in run_info_cfg_flat.items():
if key in self.base_cfg_flat.keys():
if val != self.base_cfg_flat[key]:
diff_overrides.append(f"{key}={val}")
else:
# list valued key?
components = [i if not i.isnumeric() else int(i) for i in key.split('.')]
key_intermediate = '.'.join(components[:-1])
index = components[-1]
val1 = self.base_cfg_flat[key_intermediate][index]
if val != val1:
diff_overrides.append(f"{key}={val1}")
# diff_overrides = [
# tuple(f"{key}={val1}"
# for key, val1 in run_info_cfg_flat.items()
# if key in self.base_cfg_flat.keys() and val1 != self.base_cfg_flat[key])]
return [tuple(diff_overrides)]
Hey Fredierk, As discussed earlier the concept of the issue:
I am currently trying to optimize the neurons of a (in terms of layers) fixed sized mlp, which I wrote in form of a list:
consequently, I would want to write a config file model/mlp.yaml file containing the model's layerneurons as such:
and subsequently define the sweep experiment
but unfortunately, the array unpacking is not supported.
Expected behavior Regardless of where the list is nested, I would expect, that I can index and override it. For now, it would suffice to have the last index to be unpacked properly