hydra-torch icon indicating copy to clipboard operation
hydra-torch copied to clipboard

Structured Configs with URL for torch.optim and torch.utils.data

Open tkornuta-nvidia opened this issue 4 years ago • 8 comments

Summarizing, this PR introduces:

  • [x] a separate confige.yamln configuration files for torch.optim
  • [x] a separate configen.yaml configuration files for torch.utils.data ( #1 )
  • [x] re-generated Structured Configs for modules from torch.optim
  • [x] generated Structured Config for torch.utils.data.DataLoader class

This is the first try of using configen - in short: great job with this one, @omry, "meta-program or die!" ;) Please note for generation of all Structured Configs I have used modified version of configen: (Hydra PR: https://github.com/facebookresearch/hydra/pull/1082)

I assumed we will have different contributors for different modules. So to increase the modularity I have reorganized the source folder structure (source = folder containing specification of modules to be generated). Due to the current limitation of configen (hardcoded "configen.yaml" file) the proposed solution has the following directory structure:

 - source/
    - torch.optim/configen.yaml # contains specification of all torch.optim modules
    - torch.utils.data/configen.yaml # contains specification of torch.utils.data modules

tkornuta-nvidia avatar Oct 16 '20 21:10 tkornuta-nvidia

@tkornuta-nvidia Are you envisioning we have many conf/configen-<module_specifc>.yaml files per project, rather than one monolithic config yaml per project? I'm not opposed, just wanna see if that's what you're proposing 🙂.

romesco avatar Oct 17 '20 02:10 romesco

as test, moved it to a different file - I assume we will have different contributors, hence different headers (e.g. copyright)

  1. For now I think we should stick to a single file until we have a good reason to start splitting to config groups.
  2. All contributors will use the same copyright: Facebook's. it's a requirement for all committed code (and anyone signing the CLA agrees to it).

Key 'init_config_dir' is not in struct I am not sure the configen pip package is updated, did you install from Hydra master? Take a look at the code and figure out if that needs to be there or not.

omry avatar Oct 17 '20 07:10 omry

@romesco: The CI failures are because you pushed stuff that failed CI checks. Please fix it :). We should only push stuff that passes all checks.

omry avatar Oct 17 '20 07:10 omry

also, I think we should get into the habit of always adding tests when we add new configs.

omry avatar Oct 17 '20 07:10 omry

@romesco: The CI failures are because you pushed stuff that failed CI checks. Please fix it :). We should only push stuff that passes all checks.

Yes, sorry it was because of the reorganization of file structure. It's only a linting problem in the __init__.py within optim. Fixing that.

romesco avatar Oct 17 '20 19:10 romesco

@tkornuta-nvidia Are you envisioning we have many conf/configen-<module_specifc>.yaml files per project, rather than one monolithic config yaml per project? I'm not opposed, just wanna see if that's what you're proposing 🙂.

Yes, this is what I am proposing.

  1. each file will be lighter, I think about having a file per pytorch module.
  2. the header/licenses - I need to obey some rules, I guess other (external?) contributors might need to add something to their headers too...

tkornuta-nvidia avatar Oct 19 '20 16:10 tkornuta-nvidia

@romesco: The CI failures are because you pushed stuff that failed CI checks. Please fix it :). We should only push stuff that passes all checks.

ehehe, yeah, I know - still, quoting Shaggy" wasn't me" ;)

tkornuta-nvidia avatar Oct 19 '20 16:10 tkornuta-nvidia

@tkornuta-nvidia Are you envisioning we have many conf/configen-<module_specifc>.yaml files per project, rather than one monolithic config yaml per project? I'm not opposed, just wanna see if that's what you're proposing 🙂.

Yes, this is what I am proposing.

1. each file will be lighter, I think about having a file per pytorch module.

2. the header/licenses - I need to obey some rules, I guess other (external?) contributors might need to add something to their headers too...

I think we should use Hydra to compose configs for us much like we do otherwise. configen is powered by Hydra, we can have a config group for project and do a sweep to generate configs for all projects. There are also some questions are PyTorch version and Hydra version, which may be additional sweep dimensions eventually.

omry avatar Oct 19 '20 17:10 omry