omegaconf
omegaconf copied to clipboard
Interpolations in dictionary keys
Is your feature request related to a problem? Please describe. In situations where you have several related dicts with the same keys, it would be nice to be able to define those only once somewhere an interpolate them into all the dictionary keys, to avoid errors and repetition. It would also allow one to override the corresponding keys in all the dicts at once.
Describe the solution you'd like Being able to to something like:
model:
x_label: image
y_label: class
id_column: index
network:
_target_: my_pkg.my_network.Network
data:
${model.id_column}:
_target_: my_pkg.load_col_from_dataframe # some custom function
_partial_: true
col: ${model.id_column}
${model.y_label}:
_target_: my_pkg.load_col_from_dataframe
_partial_: true
col: ${model.y_label}
${model.x_label}:
_target_: my_pkg.load_image_from_dataframe
_partial_: true
path_col: ${model.x_label}
(This is a simplified version of what I do in serotiny
Describe alternatives you've considered No really good alternatives other than manually making sure the values match.
Additional context I would use this feature heavily in the context of a project I'm working on: https://github.com/allencell/serotiny