Skip to content

disable weight download and state dict loading for model tests #4867

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

Merged
merged 10 commits into from
Nov 6, 2021

Conversation

pmeier
Copy link
Collaborator

@pmeier pmeier commented Nov 5, 2021

Fixes #4660.

cc @datumbox @pmeier

@facebook-github-bot
Copy link

facebook-github-bot commented Nov 5, 2021

💊 CI failures summary and remediations

As of commit b6e6569 (more details on the Dr. CI page):


  • 2/2 failures introduced in this PR

2 failures not recognized by patterns:

Job Step Action
CircleCI binary_libtorchvision_ops_android Build 🔁 rerun
CircleCI binary_linux_conda_py3.8_cu111 packaging/build_conda.sh 🔁 rerun

1 job timed out:

  • binary_linux_conda_py3.8_cu111

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

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.

As discussed offline, it seems it might be still downloading the weights. Worth confirming though! Marking as "request changes" to give time for more investigations.

@pmeier
Copy link
Collaborator Author

pmeier commented Nov 5, 2021

5t2xc9

)

for target in targets:
with contextlib.suppress(AttributeError):
Copy link
Collaborator Author

@pmeier pmeier Nov 5, 2021

Choose a reason for hiding this comment

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

There is (atleast) one situation where this patching doesn't work. We have the module torchvision.models.alexnet that defines the function alexnet, which is then imported into the torchvision.models namespace. Thus, after the import is complete, we can no longer access the module through torchvision.models.alexnet.

This is an anti-pattern and should be avoided. Given that we expose everything under torchvision.models, I suggest making all the other modules private. This avoids this naming issue and gives us the freedom to change the underlying structure however we want without needing to keep BC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeap, it is what it is. Not sure many other models have the same issue but I don't think it's worth breaking BC over it. Alexnet is in for historical reasons and unlikely to be used as a backbone for any modern architecture.

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.

LGTM, thanks a lot @pmeier

I've tested this and it works locally.

)

for target in targets:
with contextlib.suppress(AttributeError):
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeap, it is what it is. Not sure many other models have the same issue but I don't think it's worth breaking BC over it. Alexnet is in for historical reasons and unlikely to be used as a backbone for any modern architecture.

@pmeier pmeier merged commit f093d08 into pytorch:main Nov 6, 2021
@pmeier pmeier deleted the disable-weight-loading branch November 6, 2021 13:27
facebook-github-bot pushed a commit that referenced this pull request Nov 13, 2021
…ts (#4867)

Summary:
* disable weight download and state dict loading for model tests

* fix indent

* debug

* nuclear option

* revert unrelated change

* cleanup

* add explanation

* typo

Reviewed By: datumbox

Differential Revision: D32298972

fbshipit-source-id: 6c73192e0de442a691a993f2a4782811c5db2c32
cyyever pushed a commit to cyyever/vision that referenced this pull request Nov 16, 2021
…ch#4867)

* disable weight download and state dict loading for model tests

* fix indent

* debug

* nuclear option

* revert unrelated change

* cleanup

* add explanation

* typo
@datumbox datumbox mentioned this pull request Dec 2, 2021
3 tasks
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.

The test_detection_model_trainable_backbone_layers test shouldn't download the pretrained_backbone weights
4 participants