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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev] Auto register Configs upon import of hydra_configs.module.name #53

Open
romesco opened this issue Dec 26, 2020 · 5 comments
Open

Comments

@romesco
Copy link
Contributor

romesco commented Dec 26, 2020

Write functions of the form:
hydra_configs.torch.register(), hydra_configs.torch.optim.register(), etc.

Within these functions, call config store API:

cs = ConfigStore.instance()
cs.store(name="adamconf", node=AdamConf)

Call these in __init__.py for the module.

@omry
Copy link
Contributor

omry commented Dec 26, 2020

I don't think we need to call them automatically.

  1. we should let users control what they register.
  2. registering is not free, the configs needs to be created. as the number of installed configs grow it can become expensive to blindly register all of them.

@romesco
Copy link
Contributor Author

romesco commented Dec 26, 2020

Don't the users have control by determining which 'module' they import?

What was your alternative proposition?

@omry
Copy link
Contributor

omry commented Dec 26, 2020

Users may import the packages to use the config objects directly as well.

import hydra_configs.pytrorch

#register everything under pytorch
hydra_configs.pytrorch.register()

#register everything under pytorch.optim
hydra_configs.pytrorch.optim.register()

@romesco
Copy link
Contributor Author

romesco commented Dec 27, 2020

Ok, I think this is probably a better option. The automatic strategy would likely leave users confused about what is and what isnt currently registered. Better to be explicit and convenient.

@omry
Copy link
Contributor

omry commented Dec 27, 2020

we can make register at the top level mean recursive to make things convenient.

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

No branches or pull requests

2 participants