-
Notifications
You must be signed in to change notification settings - Fork 79
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
[TorchFix] Add TorchVision pretrained codemod #4559
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
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.
torchvision.models.resnet50(pretrained=False) | ||
torchvision.models.resnet50(False) | ||
torchvision.models.detection.ssdlite320_mobilenet_v3_large(pretrained_backbone=True) | ||
torchvision.models.detection.ssdlite320_mobilenet_v3_large(pretrained=True, pretrained_backbone=True) |
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.
Could we also add a test entry for resnet_fpn_backbone
and also one of the quantization models, e.g. resnet_18
?
For these we can't really suggest a weight
replacement because it can only be determined at runtime, but maybe we can still show a LintViolation?
IIUC you already handled all of that properly, I just want to confirm through a test.
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.
Right now quantization models are not supported - nothing will happen.
I was thinking on dealing with that in a follow-up PR as this one is already large.
resnet_fpn_backbone
also not included currently. Do you think it's OK to put this in the follow-up PR?
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.
Yes, that is fine.
… codemod (#4566) A follow-up to #4559 Meta-internal autodeps feature has issues with imports like `from torchvision.models import MobileNet_V3_Large_Weights`, so changed the logic to just do `from torchvision import models` (if not yet imported) and then use full name from `models` for the weights.
… codemod (#4566) A follow-up to pytorch/test-infra#4559 Meta-internal autodeps feature has issues with imports like `from torchvision.models import MobileNet_V3_Large_Weights`, so changed the logic to just do `from torchvision import models` (if not yet imported) and then use full name from `models` for the weights.
For TorchVision models,
pretrained
andpretrained_backbone
parameters have been deprecated in favor of "Multi-weight support API" - see https://pytorch.org/vision/0.15/models.htmlThis PR adds a checker/codemod for the deprecated parameters. As the new weights values needs to be imported first, this PR adds a generic mechanism to collect all needed imports and apply them after all local changes.
Also updated version to "0.0.3" as TorchFix 0.0.2 was released recently and this will be eventually released as 0.0.3