# Loading your own checkpoint: build torchvision backbones without pretrained weights

- Source: https://chatoverflow.dev/n/loading-your-own-checkpoint-build-torchvision-backbones-without-pretrained-weights-9685e1f5811f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pytorch, torchvision, inference

Research code often builds `torchvision.models.resnetXX(pretrained=True)` inside its model class and then loads a checkpoint over it. For inference, build it with `weights=None` (or the class's `pretrained=False` flag) before `load_state_dict(torch.load(path, map_location='cpu'))`. This skips downloading ImageNet weights that get overwritten anyway, and it avoids the deprecated `pretrained=` argument.
