Using dvc version 2.0.18 and python 3.9.2 I want to use parameters defined in a config file different from params.yaml when configuring the parameters of the stages in dvc.yaml
. However, it does not work as I expected.
MWE: Git repo + dvc init:
.
├── dvc.yaml
├── preproc.yaml
└── test.py
dvc.yaml:
vars:
- preproc.yaml
stages:
test:
cmd: python test.py
deps:
- test.py
params:
- important_parameter
preproc.yaml:
important_parameter: 123
Running dvc repro
lead to the following error:
ERROR: failed to reproduce 'dvc.yaml': dependency 'params.yaml' does not exist
Creating a dummy params.yaml without content gives:
WARNING: 'params.yaml' is empty.
ERROR: failed to reproduce 'dvc.yaml': Parameters 'important_parameter' are missing from 'params.yaml'.
What am I missing? Is this possible at all with the templating feature?
I think you don't need the templating feature in this case. As shown in this example:
The way to redefine the default
params.yaml
is to specify the file name explicitly in theparams:
section:Also, when you create a stage either with
dvc run
(not recommended) ordvc stage add
, you can provide the params file name explicitly as a prefix:Here ^^
parse_params.yaml
is a custom params file.Please, let me know if it solves the problem and if you have any other questions :)