-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dvc exp run --set-param does not change parameter values from a Python dict #6974
Comments
I can reproduce |
There is an issue with how we update the python values: dvc/dvc/utils/serialize/_py.py Lines 57 to 59 in 3143975
Wich only match assignments following that string pattern (" = foo") |
We can only have basic write support for now (see #5777). Proper write support will require us to track segments of the source code, which gets complicated to support for dict/list inner items, but can be done. I attempted this on #5778, see #5778 (comment). Unless we change anything internally, we have to live with these bugs. |
Makes sense. However, we could improve some UX interactions and/or remark this on the docs side. We are currently just ignoring the errors from params that we can't parse, which can cause some crashes afterward and/or unexpected behavior (like this issue). Perhaps we could just raise errors on unparsed params. Alternatively, we could try to collect the params that we failed to parse and check if they are actually dependencies or args to |
I would expect from #5477 that if the parameter cannot be replaced, then dvc should fail, stating that the parameter cannot be found. |
That issue / P.R. was more about missing / incorrectly parsed params. The validation happens before the replacement. We should probably validate after replacement (although afaik this is only an issue with Python format where the replacement is very hacky, as the snippet linked above). |
So dvc validates that |
Ultimately, it seems like other methods for logging parameters, like those discussed in #6506, may be a more useful approach than parsing/replacing parameters from Python files. |
Bug 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:Reproduce
git init
dvc init
echo dummyString > a.txt
dvc 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
):Environment information
Output of
dvc doctor
:The text was updated successfully, but these errors were encountered: