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

Replace deprecated weights kwarg for torchvision pretrained models #84

Open
shaikh58 opened this issue Oct 9, 2024 · 0 comments
Open

Comments

@shaikh58
Copy link
Contributor

shaikh58 commented Oct 9, 2024

PyTorch has deprecated the weights kwarg for its pretrained models API. It has been replaced with 'weights=....'. Currently our model pipelines use timm as the backend which works with the 'pretrained' flag, but this will break if 'torch' is selected as the backend.

From torchvision docs (https://pytorch.org/vision/2.0/models.html):

resnet50(weights=ResNet50_Weights.IMAGENET1K_V1)
resnet50(weights="IMAGENET1K_V1")
resnet50(pretrained=True)  # deprecated
resnet50(True)  # deprecated

Requires minor change to config file structure in model.encoder_cfg to add the weights parameter, and minor changes to visual_encoder.py to not pass the pretrained param to the constructor, but rather the weights param. The 'weights param should not be passed to timm constructors. The config names should be changed to make it more clear that weights is for PyTorch and pretrained is for timm. E.g. timm_pretrained and torch_weights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant