How to load torchvision.models.detection from local .pth file without internet

I tried to follow this answer on stackoverflow as well as the load/save tutorials

but it seems I need internet everywhere, whenever I just declare the model

model = detection.fasterrcnn_resnet50_fpn(pretrained=True)
also tried and few variations based on the github and reasoning
model = detection.fasterrcnn_resnet50_fpn(pretrained=False)

no matter if in a function or not, it tries and fails to download from the internet, so I can’t even get to the loading step.

how do I do this correctly?

Are you also seeing the failure when pretrained=False is used? This sounds weird, as nothing should be downloaded (at least I would assume it).

Hi, yes, I found the bug though, there is another parameter, pretrained_backbone which by default is set to True. If you use pretrained=False and pretrained_backbone=False it works.