```dvc exp run --queue```: deleting file 'params.yaml' for each command call
See original GitHub issueBug Report
dvc exp run --queue: deleting file ‘params.yaml’ for each command call
Description
dvc exp run --queue
deletes file ‘params.yaml’ for each trial to add a new experiment and the experiment don’t put into queue. It works correctly only if command git add params.yaml
was called before.
Reproduce
Example files: test.py
import numpy as np
import json
import yaml
params = yaml.safe_load(open('params.yaml'))["test"]
precision = np.random.random()
recall = params['value']
accuracy = np.random.random()
rows = {'precision': precision,
'recall': recall,
'accuracy': accuracy}
with open(params['metrics_path'], 'w') as outfile:
json.dump(rows, outfile)
fpr = 10*np.random.random((1,10)).tolist()
tpr = 10*np.random.random((1,10)).tolist()
with open('plot.json', 'w') as outfile2:
json.dump(
{
"roc": [ {"fpr": f, "tpr": t} for f, t in zip(fpr, tpr) ]
},
outfile2
)
params.yaml
test:
metrics_path: scores.json
value: 2
dvc.yaml
stages:
test:
cmd: python test.py
deps:
- test.py
params:
- test.metrics_path
- test.value
metrics:
- scores.json:
cache: false
plots:
- plot.json:
cache: false
x: fpr
y: tpr
dvc exp run --queue -S test.value=101
Expected
New experiments adds to queue without ‘params.yaml’ deleting.
Environment information
Ubuntu 20.04
Output of dvc doctor
:
$ dvc doctor
DVC version: 2.10.2 (pip)
---------------------------------
Platform: Python 3.9.7 on Linux-5.13.0-40-generic-x86_64-with-glibc2.31
Supports:
webhdfs (fsspec = 2022.3.0),
http (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
https (aiohttp = 3.8.1, aiohttp-retry = 2.4.6)
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/nvme0n1p6
Caches: local
Remotes: None
Workspace directory: ext4 on /dev/nvme0n1p6
Repo: dvc, git
Additional Information (if any):
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
exp run | Data Version Control - DVC
Provides a way to execute and track experimentsexperiments in your projectproject without polluting it with unnecessary commits, branches, directories, etc.
Read more >How do launch experiments in DVC? - Stack Overflow
But when I try to use command dvc exp run --queue -S test.value=101 to put experiment in queue, DVC deletes file 'params.yaml'. –...
Read more >DVC and Hydra integration - Iterative.ai
Appending and removing parameters on the fly. DVC supported a limited functionality for modifying configuration using exp run --set-param . -- ...
Read more >Turn VS Code into a One-Stop Shop for ML Experiments
Executing the command creates a small text file called raw.dvc that ... the --set-param and --queue arguments of the dvc exp run command....
Read more >Reproducible ML Experiments with Git and DVC - YouTube
Watch Milecia McGregor's talk and live coding at PyData SoCal on Reproducible experiments with Git and DVC !
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 FreeTop 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
Top GitHub Comments
I stumbled over this today and found it at least “unexpected” and did not know how to fix it, until I came here.
Applying the merge on the workspace isn’t the correct behavior, that would put
-S
modified params into the workspace and not the original params file.I think the fix for this should just be to use
stash_workspace(include_untracked=True)
here https://github.com/iterative/dvc/blob/55b16166c852a72e8dd47d4e32090063d27497e4/dvc/repo/experiments/queue/base.py#L320When we leave that context it is supposed to restore the workspace to the state before any DVC exp related changes/operations were done.
include_untracked
was omitted because we aren’t supposed to be touching untracked files at all in exps, but the bug is we actually can modify untracked files in the params file case.