Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Allow for non-leading dashes in override keys #2363

Closed
dberenbaum opened this issue Sep 2, 2022 · 7 comments 路 Fixed by #2094
Closed

[Feature Request] Allow for non-leading dashes in override keys #2363

dberenbaum opened this issue Sep 2, 2022 · 7 comments 路 Fixed by #2094
Labels
enhancement Enhanvement request

Comments

@dberenbaum
Copy link

馃殌 Feature Request

Allow for non-leading dashes to appear in override keys. For example:

$ python my_app.py +dashed-key=val
LexerNoViableAltException: +dashed-key=val
                                  ^
See https://hydra.cc/docs/next/advanced/override_grammar/basic for details

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Motivation

See iterative/dvc#8151. We rely on Hydra to enable our users to override parameters from the CLI (and it can enable other great features for our users, like complex configuration and parameter sweeps). However, we have had multiple users complain that converting our CLI overrides to Hydra has broken their use cases when they have dashes in the middle of their parameter keys.

Pitch

Describe the solution you'd like

From #514, it's clear that leading dashes (--learning-rate=0.1) are not a feature you want to support. I would like to see support for non-leading dashes so that overrides like learning-rate=0.1 work.

Describe alternatives you've considered

We may be able to find a workaround on our end, but this somewhat defeats the purpose of using Hydra for CLI overrides.

It also seems better to add in Hydra since it has general-purpose value.

Are you willing to open a pull request? (See CONTRIBUTING)

Someone on our team (cc @daavoo 馃槃) can contribute a PR if you are open to it.

Additional context

N/A

@dberenbaum dberenbaum added the enhancement Enhanvement request label Sep 2, 2022
@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 2, 2022

@dberenbaum I'm wondering if strategic use of quotation marks would make this possible. Could you please try the following?

$ python my_app.py '+"dashed-key"=val'

Ref: CLI override syntax - quoting

Edit:

Nevermind, it seems that the grammar only supports quotes on the right hand side of the equals sign.

@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 2, 2022

See PR 2094 which is closely related to this feature request.

@dberenbaum
Copy link
Author

Thanks @Jasha10! I searched the issues but not the PRs, and that one does look like it covers this issue. Since it appears stale, maybe we can try to take it over to get it merged?

@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 5, 2022

That would be great, thanks!
cc @pixelb

@dberenbaum
Copy link
Author

@Jasha10 Sorry for the delay here. It looks like that #2094 has no outstanding issues to be resolved. Can it be merged along with omry/omegaconf#880?

@Jasha10
Copy link
Collaborator

Jasha10 commented Sep 22, 2022

Right you are, @dberenbaum. I'm looking into getting those merged now.

@Jasha10 Jasha10 linked a pull request Sep 29, 2022 that will close this issue
@dberenbaum
Copy link
Author

Thank you @Jasha10!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhanvement request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants