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

[WIP][hydra-configs-torchvision] v0.7 models #65

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

Conversation

shivamdb
Copy link

@shivamdb shivamdb commented Jan 17, 2021

I have added classes for torchvison models like AlexNet, DenseNet, ResNet, SqueezeNet, GoogleNet, MNASNet

I'll add tests later.

@facebook-github-bot
Copy link

Hi @shivamdb!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@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 Jan 17, 2021
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@romesco
Copy link
Contributor

romesco commented Jan 17, 2021

Nice! Thanks for the addition! Let's keep this as a draft until we have the tests complete and passing.

@romesco romesco linked an issue Jan 17, 2021 that may be closed by this pull request
@shivamdb shivamdb marked this pull request as draft January 27, 2021 01:32
@shivamdb shivamdb marked this pull request as ready for review January 27, 2021 02:01
@@ -2,3 +2,4 @@ git+https://github.com/facebookresearch/hydra#subdirectory=tools/configen
git+https://github.com/facebookresearch/hydra
torch==1.6.0
torchvision==0.7.0
scipy
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't make the primary requirements.txt the union of the dependencies of all subprojects.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah we need to migrate this out of here. I think we should generally have per project dependencies for both using the library and running tests / doing dev.

It's not clear that someone who wants to use torchvision configs will ever use a model that depends on scipy for example, so we shouldn't force them to install it. But if they plan to do dev/run tests, then it makes sense.

Copy link
Contributor

@romesco romesco Jan 27, 2021

Choose a reason for hiding this comment

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

Otherwise I think this PR looks good.

Maybe after the minor changes, we can merge and then I can follow up with a reorganization of how we manage dependencies across projects in a new PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

The tests seems a bit too shallow to me. Is it really the best we can do to verify that the instantiated objects are good?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that the tests are minimal.

@shivamdb, would it be possible to check that both:

  1. the models instantiate correctly (which you've already done)
  2. each instantiated model is capable of running a single forward() pass?

Copy link
Contributor

@omry omry Jan 28, 2021

Choose a reason for hiding this comment

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

About the dependencies:
another approach is to put things needed to run the tests in a requirements/dev.txt.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's the plan. We can have requirements/dev.txt for each project. I can update nox to create a specific environment when testing a specific project.

Copy link
Contributor

Choose a reason for hiding this comment

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

As long as we have a handful of projects, we can also have a unified dev dependencies for all of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Addressing the above comments in #59

from typing import Any

bb = BasicBlock(10, 10)
mnasnet_dict = {"alpha": 1.0, "num_classes": 1000}
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for? Looks like it's unused. You can probably remove it.

from hydra.utils import get_class, instantiate
from omegaconf import OmegaConf

import torchvision.models as models
Copy link
Contributor

Choose a reason for hiding this comment

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

I might suggest tidying up the imports here slightly. Not the end of the world, but I think it would be better to follow PEP8:

Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.

Imports should be grouped in the following order:

  1. Standard library imports.
  2. Related third party imports.
  3. Local application/library specific imports.

You should put a blank line between each group of imports.

I'm probably also guilty of this in some of the other tests, but I want to continue improving the standards.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to integrate with isort.

@romesco
Copy link
Contributor

romesco commented Feb 20, 2021

Hey, @shivamdb, I would love to close this PR! I think it's a great addition!

How are you doing on the change requests? Do you need any more support? Happy to chat more =].

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[hydra-configs-torchvision] Configs for ImageNet models
4 participants