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

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

tkornuta-nvidia
Copy link

@tkornuta-nvidia tkornuta-nvidia commented Oct 16, 2020

Summarizing, this PR introduces:

  • a separate confige.yamln configuration files for torch.optim
  • a separate configen.yaml configuration files for torch.utils.data ( [hydra-configs-torch] Configs for Datasets and Samplers #1 )
  • re-generated Structured Configs for modules from torch.optim
  • 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: facebookresearch/hydra#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

Signed-off-by: Tomasz Kornuta <[email protected]>
@tkornuta-nvidia tkornuta-nvidia requested a review from omry October 16, 2020 21:25
@tkornuta-nvidia tkornuta-nvidia added the enhancement New feature or request label Oct 16, 2020
Signed-off-by: Tomasz Kornuta <[email protected]>
@romesco romesco self-requested a review October 17, 2020 02:30
@romesco
Copy link
Contributor

romesco commented Oct 17, 2020

@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 🙂.

@omry
Copy link
Contributor

omry commented Oct 17, 2020

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
Copy link
Contributor

omry commented Oct 17, 2020

@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
Copy link
Contributor

omry commented Oct 17, 2020

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

@romesco
Copy link
Contributor

romesco commented Oct 17, 2020

@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.

@tkornuta-nvidia
Copy link
Author

@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
Copy link
Author

tkornuta-nvidia commented Oct 19, 2020

@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" ;)

@omry
Copy link
Contributor

omry commented Oct 19, 2020

@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.

@tkornuta-nvidia tkornuta-nvidia changed the title Initial version of DataLoader Structured Configs with URL for torch.optim and torch.utils.data Oct 20, 2020
@tkornuta-nvidia tkornuta-nvidia marked this pull request as ready for review October 20, 2020 21:10
@@ -1,9 +1,13 @@
# Copyright (c) 2020, Facebook, Inc. and its affiliates. All Rights Reserved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the change from conf directory to sources directory, I think this is a good idea. I think the term conf/config/configen is very overloaded in this setting. (something I commented on a while back too). It made knowing where to look for things imo overly difficult until I got used to the lay of the land. I might even argue this should be propagated to the default dir for configen.

config/torch/optim/lr_scheduler.py Outdated Show resolved Hide resolved
@@ -66,12 +67,12 @@ class CosineAnnealingLRConf:
class ReduceLROnPlateauConf:
_target_: str = "torch.optim.lr_scheduler.ReduceLROnPlateau"
optimizer: Any = MISSING
mode: str = 'min'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @romesco pulled latest hydra changes and regenerated configs - ` -> "

Copy link
Contributor

@omry omry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hold on with this one until configen is ready to support this.

@@ -1,4 +1,5 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# SPDX-License-Identifier: MIT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change the headers until we resolve the discussion about it.

@@ -13,6 +14,7 @@

@dataclass
class AdadeltaConf:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are you changing the formatting of generated code?

Comment on lines +17 to +19
"""For more details on parameteres please refer to the original documentation:
https://pytorch.org/docs/stable/optim.html#torch.optim.Adagrad
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hold on with this change until we finalize the change to configen. This is not urgent and we can do it with configen once it's ready.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants