How to create stage with parameters?

I have a training script that has a parameter seed and the output model’s name is dependent on the seed, e.g. when seed = 0, the model name is model-0.ckpt. What is the correct way to add a stage? I tried the following but the generated dvc.yaml and .gitignore file is not correct

dvc stage add -n train \
    -d data/train.pkl -d data/val.pkl -d data/test.pkl \
    -d train.py \
    -p seed \
    -o models/model-${seed}.ckpt \
    python train.py -s ${seed}
 train:
    cmd: python train.py -s -d
    deps:
    - data/test.pkl
    - data/train.pkl
    - data/val.pkl
    - train.py
    params:
    - seed
    outs:
    - models/model-.ckpt
1 Like

@cenwangumass the best way in this case is to edit the file manually. I don’t think you can do it via CLI. You are on the right track with templating though! Let me know if editing it manually worked for you.