2

The examples for template referencing and dict unpacking assume the default params.yaml file.

So if for example I have the following params.yaml

group:
  param_one: some_value

We can do

  1. Template: python script.py --param_one ${group.param_one}
  2. Dict: python script.py ${group}

But how do I reference a custom params file?

  params:
    - config/my_params.json:
Mark Loyman
  • 1,983
  • 1
  • 14
  • 23

1 Answers1

3

You can use the top-level vars of dvc.yaml:

Given config/my_params.json:

{"group": {"foo": 1, "bar": 2}}

Your dvc.yaml would look like:

vars:
  - config/my_params.json

stages:
  echo-group:
    cmd: echo ${group}

Resulting in:

$ dvc repro
Running stage 'echo-group':                                                  
> echo --foo 1 --bar 2
--foo 1 --bar 2
Generating lock file 'dvc.lock'                                       
Updating lock file 'dvc.lock'
David de la Iglesia
  • 2,436
  • 14
  • 29