I wanted to use the resnet18 that comes from torchvision (in pretrained format) instead of the custom resnet18 that comes with fashion-compatibility/Resnet_18.py at master · mvasil/fashion-compatibility · GitHub
However, upon execution, I get this error in PyTorch 1.9.0:
(fashcomp) [jalal@goku fashion-compatibility]$ python main.py --test --l2_embed --resume runs/nondisjoint_l2norm/model_best.pth.tar --datadir ../../../data/fashion
/scratch3/venv/fashcomp/lib/python3.8/site-packages/torchvision/transforms/transforms.py:310: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
  warnings.warn("The use of the transforms.Scale transform is deprecated, " +
Downloading: "https://download.pytorch.org/models/resnet18-f37072fd.pth" to /home/grad3/jalal/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth
100.0%
=> loading checkpoint 'runs/nondisjoint_l2norm/model_best.pth.tar'
Traceback (most recent call last):
  File "main.py", line 316, in <module>
    main()    
  File "main.py", line 145, in main
    tnet.load_state_dict(checkpoint['state_dict'])
  File "/scratch3/venv/fashcomp/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1406, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Tripletnet:
	Missing key(s) in state_dict: "embeddingnet.embeddingnet.layer4.0.conv1.weight", "embeddingnet.embeddingnet.layer4.0.bn1.weight", "embeddingnet.embeddingnet.layer4.0.bn1.bias", "embeddingnet.embeddingnet.layer4.0.bn1.running_mean", "embeddingnet.embeddingnet.layer4.0.bn1.running_var", "embeddingnet.embeddingnet.layer4.0.conv2.weight", "embeddingnet.embeddingnet.layer4.0.bn2.weight", "embeddingnet.embeddingnet.layer4.0.bn2.bias", "embeddingnet.embeddingnet.layer4.0.bn2.running_mean", "embeddingnet.embeddingnet.layer4.0.bn2.running_var", "embeddingnet.embeddingnet.layer4.0.downsample.0.weight", "embeddingnet.embeddingnet.layer4.0.downsample.1.weight", "embeddingnet.embeddingnet.layer4.0.downsample.1.bias", "embeddingnet.embeddingnet.layer4.0.downsample.1.running_mean", "embeddingnet.embeddingnet.layer4.0.downsample.1.running_var", "embeddingnet.embeddingnet.layer4.1.conv1.weight", "embeddingnet.embeddingnet.layer4.1.bn1.weight", "embeddingnet.embeddingnet.layer4.1.bn1.bias", "embeddingnet.embeddingnet.layer4.1.bn1.running_mean", "embeddingnet.embeddingnet.layer4.1.bn1.running_var", "embeddingnet.embeddingnet.layer4.1.conv2.weight", "embeddingnet.embeddingnet.layer4.1.bn2.weight", "embeddingnet.embeddingnet.layer4.1.bn2.bias", "embeddingnet.embeddingnet.layer4.1.bn2.running_mean", "embeddingnet.embeddingnet.layer4.1.bn2.running_var", "embeddingnet.embeddingnet.fc.weight", "embeddingnet.embeddingnet.fc.bias". 
	Unexpected key(s) in state_dict: "embeddingnet.embeddingnet.fc_embed.weight", "embeddingnet.embeddingnet.fc_embed.bias".

I have changed the following line (commented one is the original):
#model = Resnet_18.resnet18(pretrained=True, embedding_size=args.dim_embed)
model = torchvision.models.resnet18(pretrained=True)