Search code examples
configdvc

How to change and set up dvc config file so can manage the weights file?


Im currently managing the weight file by dvc. This is the dvc file:

outs:
- md5: b2c80e73090cae013eef778308faf8fc
  size: 202055043
  path: checkpoint_1.pth.tar

So I would like to create a dvc config file so that when it's necessary to change the weight file then I change the dvc config file. My current config yaml file for the weights is like

...
robot_perception_detector:
    ros__parameters:
      weights: /home/ros2/foxy/src/robot_pkg/data/model_weights/checkpoint_1.pth.tar
 ....     

Any help and advice how this config file should looks like so that works in both cases?


Solution

  • You are probably looking for Templating. The very first example templates an output file:

    params.yaml:

    models:
      us:
        threshold: 10
        filename: 'model-us.hdf5'
    

    dvc.yaml:

    stages:
      build-us:
        cmd: >-
          python train.py
          --thresh ${models.us.threshold}
          --out ${models.us.filename}
        outs:
          - ${models.us.filename}:
              cache: true