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

Adding Weights classes for Resnet classification models #4655

Merged
merged 19 commits into from
Oct 20, 2021

Conversation

jdsgomes
Copy link
Contributor

@jdsgomes jdsgomes commented Oct 19, 2021

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

@jdsgomes Look great. Just a minor typo:

torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
torchvision/prototype/models/resnet.py Outdated Show resolved Hide resolved
@jdsgomes
Copy link
Contributor Author

Local prototype test results

~/v/test ❯❯❯ pytest test_prototype_models.py -vvv                                                                                                                                            ✘ 1 
====================================================================================== test session starts =======================================================================================
platform darwin -- Python 3.8.8, pytest-6.2.3, py-1.10.0, pluggy-0.13.1 -- /Users/jdsgomes/homebrew/anaconda3/bin/python
cachedir: .pytest_cache
rootdir: /Users/jdsgomes/vision, configfile: pytest.ini
plugins: anyio-2.2.0
collected 36 items                                                                                                                                                                               

test_prototype_models.py::test_classification_model[cpu-resnet18] PASSED                                                                                                                   [  2%]
test_prototype_models.py::test_classification_model[cpu-resnet34] PASSED                                                                                                                   [  5%]
test_prototype_models.py::test_classification_model[cpu-resnet50] PASSED                                                                                                                   [  8%]
test_prototype_models.py::test_classification_model[cpu-resnet101] PASSED                                                                                                                  [ 11%]
test_prototype_models.py::test_classification_model[cpu-resnet152] PASSED                                                                                                                  [ 13%]
test_prototype_models.py::test_classification_model[cpu-resnext50_32x4d] PASSED                                                                                                            [ 16%]
test_prototype_models.py::test_classification_model[cpu-resnext101_32x8d] PASSED                                                                                                           [ 19%]
test_prototype_models.py::test_classification_model[cpu-wide_resnet50_2] PASSED                                                                                                            [ 22%]
test_prototype_models.py::test_classification_model[cpu-wide_resnet101_2] PASSED                                                                                                           [ 25%]
test_prototype_models.py::test_classification_model[cuda-resnet18] SKIPPED (CUDA device not available)                                                                                     [ 27%]
test_prototype_models.py::test_classification_model[cuda-resnet34] SKIPPED (CUDA device not available)                                                                                     [ 30%]
test_prototype_models.py::test_classification_model[cuda-resnet50] SKIPPED (CUDA device not available)                                                                                     [ 33%]
test_prototype_models.py::test_classification_model[cuda-resnet101] SKIPPED (CUDA device not available)                                                                                    [ 36%]
test_prototype_models.py::test_classification_model[cuda-resnet152] SKIPPED (CUDA device not available)                                                                                    [ 38%]
test_prototype_models.py::test_classification_model[cuda-resnext50_32x4d] SKIPPED (CUDA device not available)                                                                              [ 41%]
test_prototype_models.py::test_classification_model[cuda-resnext101_32x8d] SKIPPED (CUDA device not available)                                                                             [ 44%]
test_prototype_models.py::test_classification_model[cuda-wide_resnet50_2] SKIPPED (CUDA device not available)                                                                              [ 47%]
test_prototype_models.py::test_classification_model[cuda-wide_resnet101_2] SKIPPED (CUDA device not available)                                                                             [ 50%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnet18] PASSED                                                                                                      [ 52%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnet34] PASSED                                                                                                      [ 55%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnet50] PASSED                                                                                                      [ 58%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnet101] PASSED                                                                                                     [ 61%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnet152] PASSED                                                                                                     [ 63%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnext50_32x4d] PASSED                                                                                               [ 66%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-resnext101_32x8d] PASSED                                                                                              [ 69%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-wide_resnet50_2] PASSED                                                                                               [ 72%]
test_prototype_models.py::test_old_vs_new_classification_factory[cpu-wide_resnet101_2] PASSED                                                                                              [ 75%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnet18] SKIPPED (CUDA device not available)                                                                        [ 77%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnet34] SKIPPED (CUDA device not available)                                                                        [ 80%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnet50] SKIPPED (CUDA device not available)                                                                        [ 83%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnet101] SKIPPED (CUDA device not available)                                                                       [ 86%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnet152] SKIPPED (CUDA device not available)                                                                       [ 88%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnext50_32x4d] SKIPPED (CUDA device not available)                                                                 [ 91%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-resnext101_32x8d] SKIPPED (CUDA device not available)                                                                [ 94%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-wide_resnet50_2] SKIPPED (CUDA device not available)                                                                 [ 97%]
test_prototype_models.py::test_old_vs_new_classification_factory[cuda-wide_resnet101_2] SKIPPED (CUDA device not available)                                                                [100%]

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Thanks for adding tests, this is very much needed. I left a couple of comments, let me know what you think.

.circleci/unittest/linux/scripts/run_test.sh Outdated Show resolved Hide resolved
test/test_prototype_models.py Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Last set of optional nitpicks, feel free to accept/decline at will.

Also we will need to adapt this slightly once #4664 is merged but other than this, we should be good to go.

test/test_prototype_models.py Outdated Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
test/test_prototype_models.py Outdated Show resolved Hide resolved
jdsgomes and others added 6 commits October 20, 2021 10:51
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your PR and patience @jdsgomes.

I think it looks great, I'll merge once the CI turns green.

@datumbox datumbox merged commit 80e6aff into pytorch:main Oct 20, 2021
@github-actions
Copy link

Hey @datumbox!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

@datumbox datumbox linked an issue Oct 20, 2021 that may be closed by this pull request
13 tasks
facebook-github-bot pushed a commit that referenced this pull request Oct 26, 2021
Summary:
* adding Weights classes for Resnet classification models

* Replacing BasicBlock by Bottleneck in all but 3 model contructors

* adding tests for prototype models

* fixing typo in environment variable

* Update test/test_prototype_models.py

* changing default value for PYTORCH_TEST_WITH_PROTOTYPE

* adding checks to compare outputs of the prototype vs old models

* refactoring prototype tests

* removing unused imports

* applying ufmt

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

* Update test/test_prototype_models.py

Reviewed By: NicolasHug

Differential Revision: D31916320

fbshipit-source-id: 6a379c2318de8448bf2b89174e789b866071eba5

Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
Co-authored-by: Vasilis Vryniotis <[email protected]>
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
* adding Weights classes for Resnet classification models

* Replacing BasicBlock by Bottleneck in all but 3 model contructors

* adding tests for prototype models

* fixing typo in environment variable

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* changing default value for PYTORCH_TEST_WITH_PROTOTYPE

* adding checks to compare outputs of the prototype vs old models

* refactoring prototype tests

* removing unused imports

* applying ufmt

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

* Update test/test_prototype_models.py

Co-authored-by: Vasilis Vryniotis <[email protected]>

Co-authored-by: Vasilis Vryniotis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-pretrained weights: Add model builders for Classification
3 participants