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

Disable pretrained backbone downloading if pretrained is True #3325

Merged
merged 3 commits into from
Jan 29, 2021

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Jan 29, 2021

Fixes #3322

Description:

  • Avoid downloading backbone weights and then segmentation model weights:
    Actual behaviour:
python -c "import torchvision as tv; tv.models.segmentation.fcn_resnet101(pretrained=True)"
Downloading: "https://download.pytorch.org/models/resnet101-5d3b4d8f.pth" to /root/.cache/torch/hub/checkpoints/resnet101-5d3b4d8f.pth
100%|█████████| 170M/170M [00:01<00:00, 99.8MB/s]
Downloading: "https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth" to /root/.cache/torch/hub/checkpoints/fcn_resnet101_coco-7ecb50ca.pth
100%|█████████| 208M/208M [00:02<00:00, 102MB/s]

and new behaviour

python -c "import torchvision as tv; tv.models.segmentation.fcn_resnet101(pretrained=True)"
Downloading: "https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth" to /root/.cache/torch/hub/checkpoints/fcn_resnet101_coco-7ecb50ca.pth
100%|█████████| 208M/208M [00:02<00:00, 88.5MB/s]

Disable pretrained backbone downloading if pretrained is True
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!

@codecov
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #3325 (eb16bd8) into master (6116812) will increase coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3325      +/-   ##
==========================================
+ Coverage   73.84%   73.96%   +0.11%     
==========================================
  Files         104      104              
  Lines        9606     9607       +1     
  Branches     1537     1537              
==========================================
+ Hits         7094     7106      +12     
+ Misses       2033     2024       -9     
+ Partials      479      477       -2     
Impacted Files Coverage Δ
torchvision/models/segmentation/segmentation.py 74.07% <0.00%> (-0.93%) ⬇️
torchvision/datasets/video_utils.py 69.27% <0.00%> (ø)
torchvision/models/detection/_utils.py 82.58% <0.00%> (ø)
torchvision/models/quantization/resnet.py 93.25% <0.00%> (ø)
torchvision/models/quantization/googlenet.py 64.77% <0.00%> (ø)
torchvision/models/quantization/inception.py 30.89% <0.00%> (ø)
torchvision/models/detection/backbone_utils.py 88.05% <0.00%> (ø)
torchvision/models/quantization/shufflenetv2.py 90.16% <0.00%> (ø)
torchvision/transforms/functional_tensor.py 79.23% <0.00%> (+0.19%) ⬆️
torchvision/models/detection/anchor_utils.py 94.66% <0.00%> (+1.33%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6116812...c19d9fc. Read the comment docs.

@datumbox datumbox merged commit 3673716 into pytorch:master Jan 29, 2021
@datumbox datumbox mentioned this pull request Jan 29, 2021
13 tasks
facebook-github-bot pushed a commit that referenced this pull request Feb 4, 2021
Summary:
Disable pretrained backbone downloading if pretrained is True

Reviewed By: datumbox

Differential Revision: D26226604

fbshipit-source-id: 07ac6236c4e6fd52677406842843d8a3059a9900

Co-authored-by: Vasilis Vryniotis <datumbox@users.noreply.github.com>
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.

a question about segmentation model loading
3 participants