-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Simpler param updates with python-benedict #4780
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
Simpler param updates with python-benedict #4780
Conversation
eca373a to
8fe0b17
Compare
dvc/repo/experiments/run.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, this now returns a dict like:
{'path.to.key': yamlValue1, 'path[2]key': yamlValue2}
dvc/repo/experiments/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you prefer local or global imports. Since this is only needed for the beta experiments feature, I figured local was appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the change in syntax, which I think is more in line with your future plans.
8fe0b17 to
31db81e
Compare
|
This is very cool, thanks for the PR! Since this will add a dependency I want to discuss this internally with the rest of the DVC team first before merging it, but everything looks good to me for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax is not easy to understand/use. At a first glance, I associated those =- together and assumed it was removing items from the list.
Ideally, I'd like to have the following syntax:
$ dvc exp run --params 'foo[1]=[baz, goo]' 'bar={a:2, b: 3}'I understand that we split it up by comma, so we cannot achieve that. We should consider using a different delimiter, maybe even space or semicolon and make it look JSON-like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a natural progression to support appending and removing similar to Hydra's syntax (they use ~foo to remove and +foo=value to append).
Or, maybe even use Hydra later directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I didn't change anything regarding the syntax. This is the syntax already accepted by the yaml parser being used, which is separate from this change. I'm simply documenting what currently works.
That said, I agree that it it would be nice to be able to specify arguments that include commas, and I think that your suggestion of simply changing --params to read a list instead of a single string would be the most straight-forward way of doing it.
31db81e to
39847ba
Compare
|
Rebased this PR and created #4883 for future consideration regarding hydra |
|
Thanks for the PR @sjawhar! |
β¦limit * 'master' of github.com:iterative/dvc: dag: add --outs option (treeverse#4739) Add test server and tests for webdav (treeverse#4827) Simpler param updates with python-benedict (treeverse#4780) checkpoints: set DVC_ROOT environment variable (treeverse#4877) api: add support for simple wildcards (treeverse#4864) tests: mark azure test as flaky (treeverse#4881) setup.py: limit responses version for moto (treeverse#4879) remote: avoid chunking on webdav. Fixes treeverse#4796 (treeverse#4828) checkpoints: `exp run` and `exp res[ume]` refactor (treeverse#4855)
|
@pmrowla Since hydra would change the syntax for this, I guess we better to do the switch before 2.0 if we indeed decide to go with it? Your call here. Could revert, or could submit benedict to conda-forge if we want (will be happy to help with sending one, we've sent a few already). |
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. π
Description of Changes
Following up on my last comment on #4769
So I did some testing and my idea to use benedict to simplify the code actually works great...
almost. (Update: figured it out) As you can see in the changes here, you can replace a lot of code with a single built-in function call. This also has the benefit of using more standard[0]syntax for list accessing.I added more tests to make sure that everything was working, then I ran into this strange behavior on a single test case:The params are being correctly updated and written, but for some reason the experiment doesn't seem to actually run the copy step. It's strange, and I would appreciate any help chasing this down...I just needed to add
gooto the list of stage params π€¦Linting is failing on changes I didn't make.
TODO