-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Add OR Override-if-exists #1049
Comments
I understand the request, but t looks like you are trying to work around incomplete configuration. @dataclass
class NemoConfig:
gpus: int = 1
# composing (I think it's better here):
@dataclass
class AppConfig:
nemo : NemoConfig = NemoConfig()
# or extending
@dataclass
class AppConfig2(NemoConfig):
... |
My use-case/motivation is slightly different:
The problem was that some scripts assumed presence of a particular parameter ("gpus") in yaml files, and the other did not. So I did not wanted to create a big "if-else" case in the entrypoint script.
some scripts were working, while in others hydra was raising errors (as gpus wasn't present in some yaml files). Analogically, with:
some other scripts weren't working. I have solved that by using Structured Configs (as in Feature Request 1048), but still the problem of having a parameter disregarding it added or overriden remains... |
When you are overriding If the script does support multigpus but it calls it My proposal is to require scripts that re being executed via the entrypoint script to follow a protocol. Having said all that, this may still be a useful thing to support. but I am not sure your use-case is convincing enough. |
Hey @omry thanks for the reply. So I have solved that issue with Structured Configs - but I brought up that example just to indicate the problem.
Yap, your thinking is 100% correct. But please note one thing:
I am just saying that I am missing solution when one wants to override the parameters disregarding its presence in the original configuration. Hmmmm, when the problem is defined like this, I am starting to think that maybe the solution is to stay with "+", but add to hydra option similar to arg_parse |
As I pointed out in the comment on #1052, a solution here is to use dictionary merge, which has a different semantics.
This covers you if you have a key though, I don't think you can use this to add a top level key. |
🚀 Feature Request
Add option to "Add-OR-Override-if-exists" to command line params
e.g.
Motivation
Hydra offers few options to handle params from command line:
Note +gpus will raise an error if it was already present in the configuration.
So the case, when we want to have gpus set to 2, disregarding whether it was present in yaml file or now, is missing.
The text was updated successfully, but these errors were encountered: