Skip to content

Nested Looping in Parameterization #5172

Closed
@bharathc346

Description

@bharathc346

This feature request is in regards to the experimental parameterization feature here: https://github.com/iterative/dvc/wiki/Parametrization

Currently if in params.yaml if one has

  models:
    a:
      features: 1
    a:
      features: 2
    b:
      features: 1
    b:
      features: 2

we can have dvc.yaml as so

stages:
  build:
    foreach: ${models}
    do:
      cmd: >- 
          python script.py
          --model ${item}
          --features ${item.features}

Currently dvc.yaml can only loop over one thing e.g models in this case. I am wondering if something like this would be possible:

# params.yaml

models: 
  - a
  - b
features: 
  - 1
  - 2

and

# dvc.yaml

stages:
  build:
    foreach: ${models}
    foreach: ${features}
    do:
      cmd: >- 
          python script.py
          --model ${item_0}
          --features ${item_1}

This would be great as one wouldn't have to specify all possible configurations in params.yaml.
@skshetry tagging you as I believe you have been working on parameterization.

Metadata

Metadata

Assignees

Labels

A: templatingRelated to the templating featurediscussionrequires active participation to reach a conclusionfeature requestRequesting a new featurep1-importantImportant, aka current backlog of things to do

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions