dvc exp run --set-param does not change parameter values from a Python dict
See original GitHub issueBug Report
dvc exp run --set-param does not change parameter values from a Python dict
Description
When trying to do dvc exp run --set-param my_params.py:my_dict.my_key=3 the parameter value is not changed to 3, it remains the same as previously. The output is:
Stage 'my_stage' didn't change, skipping
Reproduce
git initdvc init- dvc.yaml
stages:
my_stage:
cmd: cat a.txt > b.txt
deps:
- a.txt
outs:
- b.txt
params:
- my_params.py:
- my_dict
- my_params.py
my_dict = {
'my_key': 2
}
echo dummyString > a.txtdvc exp run --set-param my_params.py:my_dict.my_key=3
Expected
I would expect this output (which can be achieved by changing the value of my_key manually in my_params.py and then running dvc exp run):
Running stage 'my_stage':
> cat a.txt > b.txt
Updating lock file 'dvc.lock'
To track the changes with git, run:
git add dvc.yaml a.txt dvc.lock my_params.py
Reproduced experiment(s): exp-e60e4
Experiment results have been applied to your workspace.
To promote an experiment to a Git branch run:
dvc exp branch <exp> <branch>
Environment information
Output of dvc doctor:
$ dvc doctor
DVC version: 2.8.3 (pip)
---------------------------------
Platform: Python 3.8.10 on Linux-5.11.0-40-generic-x86_64-with-glibc2.29
Supports:
webhdfs (fsspec = 2021.10.1),
http (aiohttp = 3.7.4.post0, aiohttp-retry = 2.4.5),
https (aiohttp = 3.7.4.post0, aiohttp-retry = 2.4.5),
s3 (s3fs = 2021.8.1, boto3 = 1.17.106)
Cache types: reflink, hardlink, symlink
Cache directory: xfs on /dev/sdb
Caches: local
Remotes: None
Workspace directory: xfs on /dev/sdb
Repo: dvc, git
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
exp run | Data Version Control - DVC
Use the --set-param ( -S ) option as a shortcut to change parameterparameter values on-the-fly before running the experiment.
Read more >Using Experiments for Transfer Learning - Iterative.ai
DVC experiments help fine-tune models by tracking code and data changes. ... using the --set-param or the shorthand -S option on dvc exp...
Read more >How do launch experiments in DVC? - Stack Overflow
I solved my problem. It is necessary, that all files (executable scripts, 'dvc.yaml', 'params.yaml') be tracked by git. In this case dvc exp...
Read more >See raw diff - Hugging Face
Caller may update this list as he - wishes: none of those changes will affect the ... Args: - run: A string name...
Read more >Untitled
Artat enterprise saudi arabia, 2010 harley sportster oil change. ... Utilidad acumulada wikipedia, Rl grime and what so not tell me mp3, Civic...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ultimately, it seems like other methods for logging parameters, like those discussed in https://github.com/iterative/dvc/discussions/6506, may be a more useful approach than parsing/replacing parameters from Python files.
So dvc validates that
my_params.py:my_dict.my_keyexists but can’t replace it? In that case, I agree that we should probably raise an error to say something likeUnable to parse {file} to set parameter {key}. Please update {file} instead of using --set-param.