dvc.org icon indicating copy to clipboard operation
dvc.org copied to clipboard

ref: `exp run --set-param` with templating

Open skshetry opened this issue 4 years ago • 5 comments

It'd be great to have an example of experiments coupled with the parametrization (or at least a mention that it's possible?).

# dvc.yaml
stages:
  build:
      cmd: python src/main.py ${test_size}
      deps:
        - src/main.py
      outs:
        - model.pickle
      metrics:
        - metrics.json:
            cache: false
$ dvc exp run --set-param "test_size=0.5"

skshetry avatar Mar 18 '21 16:03 skshetry

So in this case, with exp run -S test_size=30, the cmd in dvc.yaml would be python src/main.py 30? @skshetry

That would def. be pretty important to mention both in https://dvc.org/doc/user-guide/project-structure/pipelines-files#templating, as well as in Exps docs (for starters in the exp run -S ref.).

But what if test_size is not in a params file, just a vars entry?

jorgeorpinel avatar Mar 18 '21 21:03 jorgeorpinel

Sorry for the late response, @jorgeorpinel. You are right that it's not possible if the vars is locally declared or imported from other files than the params.yaml.

This is more of a coincidence in that --set-params can change params.yaml by default, and so does the templating, so it seems that they work together for that file.

For other files that are referenced, you'd need to do --set-param <filename>:<params>. I am just assuming here that for the most part, it'll be from params.yaml file.

skshetry avatar Sep 27 '21 04:09 skshetry

For other files that are referenced, you'd need to do --set-param :

Sure, as long as there's a way to generalize this "coincidence" I think we can indeed emphasize it as a feature 👍 (only with param file values though, not vars).

jorgeorpinel avatar Oct 04 '21 23:10 jorgeorpinel

Since it's the cmd ref, would you be able to send a draft PR for this change @skshetry ? Could just copy the example above for now. We'll take over the explanation, formatting, etc. if needed.

jorgeorpinel avatar Oct 04 '21 23:10 jorgeorpinel

Sorry, I won't have any time this week/month.

skshetry avatar Oct 05 '21 06:10 skshetry