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] Determine if namespace packaging will work for imports alongside pytorch. #27

Closed
romesco opened this issue Oct 25, 2020 · 2 comments

Comments

@romesco
Copy link
Contributor

romesco commented Oct 25, 2020

Quoting @omry:

In an ideal world, the configs would be packaged with PyTorch itself, so probably:
torch.optim.AdamConf

I agree with this.

Alternatives are torch_config.optim.AdamConf. Using config.* is probably too generic of a module name and I imagine could lead to collisions.

@omry
Copy link
Contributor

omry commented Oct 25, 2020

Keep in mind that whatever decision we have should either be friendly to what configen supports now or be added there.
I don't think we can do torch_config.optim.AdamConf right now.

see module_path_pattern.

@romesco
Copy link
Contributor Author

romesco commented Oct 31, 2020

Alright, until someone can raise an issue, we are going to stick with: hydra_configs.<module_path>. If others create their own configen configs such as: https://github.com/romesco/hydra-lightning for example, the idea is to ensure the package is set up as a compatible native namespace package. This means the module dir name is config and there is no __init__.py at the top level.

If those conventions are adhered to, many structured configs from different projects can be imported along side each other like in this example:

# structured config imports
from hydra_configs.torch.optim import AdamConf
from hydra_configs.torchvision.datasets import DatasetFolderConf
from hydar_configs.pytorch_lightning.trainer import TrainerConf

from
https://github.com/romesco/hydra-lightning/blob/50707694e7da1bab7753fb80402be7f26427f5f5/examples/mnist_00.py#L20-L22

@romesco romesco closed this as completed Oct 31, 2020
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