dvc
dvc copied to clipboard
Support Access of Dictionary Items in matrix-stages
When I work with matrix-stages I would like to use further parameters for each item, specified in the params.yaml
A prototpy-stage would look like
# dvc.yaml
stages:
eval:
matrix:
model: ${models}
testset: ${testsets}
cmd: python src/eval_script.py --model ${item.model} --evalset ${item.evalset} --model-family ${item.model.family}
...
And the params.yaml would be:
# params.yaml
models:
m1:
family: b21
m2:
family: x22
testsets: [evalA, evalB]
This is similar to foreach-stages, where you can access properties by calling ${item.property}
@skshetry Thoughts on this request?
This seems a natural functionality to be present, similar to foreach indeed. I've got a two-in-one case to use. Having large data split in multiple subdirectories, and several preprocessors, I generate matrix stages, one per (preprocessor x data_subdir).
- I have several dict configs defining subsets of data subdirs, and would like to combine them via Hydra. But since Hydra supports only dict extension and not list extension (and matrix can't access items of dict), this seems impossible atm (requires creating additional config files for each combination).
- For each preprocessor (dict config), I'd like to place a dependency on file containing it's class. Once again, can't access the type from dict config in matrix. Could be accessed in via nested interpolation from main config, but that doesn't work as well.