-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Check sha256 of weights #7219
Check sha256 of weights #7219
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it up to @NicolasHug to review this with respect to torch.hub
, since he is the specialist here. From my naive understanding, this should be an innocent addition that could improve security.
Ping @NicolasHug |
After the release please @adamjstewart :) #7210 (comment) |
Would love to get this into the release but if it's past the feature freeze it can wait. |
@adamjstewart Branch cut was last Friday, so it won't make it into the next release. |
@NicolasHug congrats on the new release! I know there's always fallout from new releases, but once that settles down, a gentle reminder to review this PR. I rebased so we can test it against the latest version. |
0c23a52
to
78f9ad4
Compare
Ping @NicolasHug |
Ping ping @NicolasHug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping and for your patience @adamjstewart .
PR looks good, I agree it should be enough to enable sha checks on torchgeo's end.
Before mergning, do you mind updating the rest of the weights.get_state_dict(...)
calls to use check_hash
everywhere?
The remaining ones should be these:
(pt) ➜ vision git:(weights/hash) ✗ git grep "get_state_dict(pro.*ss)"
torchvision/models/detection/faster_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/faster_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/faster_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/fcos.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/keypoint_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/mask_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/mask_rcnn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/retinanet.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/retinanet.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/ssd.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/detection/ssdlite.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/optical_flow/raft.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/googlenet.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/inception.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/mobilenetv2.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/mobilenetv3.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/resnet.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/quantization/shufflenetv2.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/deeplabv3.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/deeplabv3.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/deeplabv3.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/fcn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/fcn.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/segmentation/lraspp.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/video/mvit.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/video/resnet.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/video/s3d.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/models/video/swin_transformer.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/prototype/models/depth/stereo/crestereo.py: model.load_state_dict(weights.get_state_dict(progress=progress))
torchvision/prototype/models/depth/stereo/raft_stereo.py: model.load_state_dict(weights.get_state_dict(progress=progress))
If that makes it easier for you, feel free to just revert the changes you made to the calls to get_state_dict()
in this PR and we can address them all in a later PR.
d179784
to
ff6f6d6
Compare
@NicolasHug I believe I got all the remaining ones, let me know if I missed anything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @adamjstewart , the PR LGTM. Our CI is a bit toasted right now so I'll try to merge it some time later. Nothing more to do on your side though :)
Thanks!
Summary: Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com> Reviewed By: vmoens Differential Revision: D45523936 fbshipit-source-id: 3febf3a0f410cc1af38cfac91d18c7e83213bd4f
@NicolasHug @nps1ngh @pmeier would this be sufficient to close #7210? This should be fully backwards compatible in case someone wants to use weights without a sha256 hash suffix. We'll rename all of our weights in TorchGeo to add the suffix.