how can I load pretrained model by pytorch? ( mmfashion)
import io

import torch
import torch.nn as nn
from torchvision import models
from PIL import Image
import torchvision.transforms as transforms

checkpoint_path = 'C:/venvs/ai/aiproduct/latest.pth'
pretrained_weights = torch.load(checkpoint_path, map_location='cpu', strict=False)

model = models.resnet50(pretrained=True)
model.load_state_dict(pretrained_weights)

this bring
TypeError: 'strict' is an invalid keyword argument for load()

and
import io

import torch
import torch.nn as nn
from torchvision import models
from PIL import Image
import torchvision.transforms as transforms

checkpoint_path = 'C:/venvs/ai/aiproduct/latest.pth'
pretrained_weights = torch.load(checkpoint_path, map_location='cpu')

model = models.resnet50(pretrained=True)
model.load_state_dict(pretrained_weights)
# model.eval()
print(model)
# model.summary()


if I get rid of &quot;strict&quot;
Traceback (most recent call last):
  File &quot;c:\venvs\ai\aiproduct\test.py&quot;, line 13, in &lt;module&gt;
    model.load_state_dict(pretrained_weights)
  File &quot;C:\Python39\lib\site-packages\torch\nn\modules\module.py&quot;, line 1223, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ResNet:
        Missing key(s) in state_dict: &quot;conv1.weight&quot;, &quot;bn1.weight&quot;, &quot;bn1.bias&quot;, &quot;bn1.running_mean&quot;, &quot;bn1.running_var&quot;, &quot;layer1.0.conv1.weight&quot;, &quot;layer1.0.bn1.weight&quot;, &quot;layer1.0.bn1.bias&quot;, &quot;layer1.0.bn1.running_mean&quot;, &quot;layer1.0.bn1.running_var&quot;, &quot;layer1.0.conv2.weight&quot;, &quot;layer1.0.bn2.weight&quot;, &quot;layer1.0.bn2.bias&quot;, &quot;layer1.0.bn2.running_mean&quot;, &quot;layer1.0.bn2.running_var&quot;, &quot;layer1.0.conv3.weight&quot;, &quot;layer1.0.bn3.weight&quot;, &quot;layer1.0.bn3.bias&quot;, &quot;layer1.0.bn3.running_mean&quot;, &quot;layer1.0.bn3.running_var&quot;, &quot;layer1.0.downsample.0.weight&quot;, &quot;layer1.0.downsample.1.weight&quot;, &quot;layer1.0.downsample.1.bias&quot;, &quot;layer1.0.downsample.1.running_mean&quot;, &quot;layer1.0.downsample.1.running_var&quot;, &quot;layer1.1.conv1.weight&quot;, &quot;layer1.1.bn1.weight&quot;, &quot;layer1.1.bn1.bias&quot;, &quot;layer1.1.bn1.running_mean&quot;, &quot;layer1.1.bn1.running_var&quot;, &quot;layer1.1.conv2.weight&quot;, &quot;layer1.1.bn2.weight&quot;, &quot;layer1.1.bn2.bias&quot;, &quot;layer1.1.bn2.running_mean&quot;, 
&quot;layer1.1.bn2.running_var&quot;, &quot;layer1.1.conv3.weight&quot;, &quot;layer1.1.bn3.weight&quot;, &quot;layer1.1.bn3.bias&quot;, &quot;layer1.1.bn3.running_mean&quot;, &quot;layer1.1.bn3.running_var&quot;, &quot;layer1.2.conv1.weight&quot;, &quot;layer1.2.bn1.weight&quot;, &quot;layer1.2.bn1.bias&quot;, &quot;layer1.2.bn1.running_mean&quot;, &quot;layer1.2.bn1.running_var&quot;, &quot;layer1.2.conv2.weight&quot;, &quot;layer1.2.bn2.weight&quot;, &quot;layer1.2.bn2.bias&quot;, &quot;layer1.2.bn2.running_mean&quot;, &quot;layer1.2.bn2.running_var&quot;, &quot;layer1.2.conv3.weight&quot;, &quot;layer1.2.bn3.weight&quot;, &quot;layer1.2.bn3.bias&quot;, &quot;layer1.2.bn3.running_mean&quot;, &quot;layer1.2.bn3.running_var&quot;, &quot;layer2.0.conv1.weight&quot;, &quot;layer2.0.bn1.weight&quot;, &quot;layer2.0.bn1.bias&quot;, &quot;layer2.0.bn1.running_mean&quot;, &quot;layer2.0.bn1.running_var&quot;, &quot;layer2.0.conv2.weight&quot;, &quot;layer2.0.bn2.weight&quot;, &quot;layer2.0.bn2.bias&quot;, &quot;layer2.0.bn2.running_mean&quot;, &quot;layer2.0.bn2.running_var&quot;, &quot;layer2.0.conv3.weight&quot;, &quot;layer2.0.bn3.weight&quot;, &quot;layer2.0.bn3.bias&quot;, &quot;layer2.0.bn3.running_mean&quot;, &quot;layer2.0.bn3.running_var&quot;, &quot;layer2.0.downsample.0.weight&quot;, &quot;layer2.0.downsample.1.weight&quot;, &quot;layer2.0.downsample.1.bias&quot;, &quot;layer2.0.downsample.1.running_mean&quot;, &quot;layer2.0.downsample.1.running_var&quot;, &quot;layer2.1.conv1.weight&quot;, &quot;layer2.1.bn1.weight&quot;, &quot;layer2.1.bn1.bias&quot;, &quot;layer2.1.bn1.running_mean&quot;, &quot;layer2.1.bn1.running_var&quot;, &quot;layer2.1.conv2.weight&quot;, &quot;layer2.1.bn2.weight&quot;, &quot;layer2.1.bn2.bias&quot;, &quot;layer2.1.bn2.running_mean&quot;, &quot;layer2.1.bn2.running_var&quot;, &quot;layer2.1.conv3.weight&quot;, &quot;layer2.1.bn3.weight&quot;, &quot;layer2.1.bn3.bias&quot;, &quot;layer2.1.bn3.running_mean&quot;, &quot;layer2.1.bn3.running_var&quot;, &quot;layer2.2.conv1.weight&quot;, &quot;layer2.2.bn1.weight&quot;, &quot;layer2.2.bn1.bias&quot;, &quot;layer2.2.bn1.running_mean&quot;, &quot;layer2.2.bn1.running_var&quot;, &quot;layer2.2.conv2.weight&quot;, &quot;layer2.2.bn2.weight&quot;, &quot;layer2.2.bn2.bias&quot;, &quot;layer2.2.bn2.running_mean&quot;, &quot;layer2.2.bn2.running_var&quot;, &quot;layer2.2.conv3.weight&quot;, &quot;layer2.2.bn3.weight&quot;, &quot;layer2.2.bn3.bias&quot;, &quot;layer2.2.bn3.running_mean&quot;, &quot;layer2.2.bn3.running_var&quot;, &quot;layer2.3.conv1.weight&quot;, &quot;layer2.3.bn1.weight&quot;, &quot;layer2.3.bn1.bias&quot;, &quot;layer2.3.bn1.running_mean&quot;, &quot;layer2.3.bn1.running_var&quot;, &quot;layer2.3.conv2.weight&quot;, &quot;layer2.3.bn2.weight&quot;, &quot;layer2.3.bn2.bias&quot;, &quot;layer2.3.bn2.running_mean&quot;, &quot;layer2.3.bn2.running_var&quot;, &quot;layer2.3.conv3.weight&quot;, &quot;layer2.3.bn3.weight&quot;, &quot;layer2.3.bn3.bias&quot;, &quot;layer2.3.bn3.running_mean&quot;, &quot;layer2.3.bn3.running_var&quot;, &quot;layer3.0.conv1.weight&quot;, &quot;layer3.0.bn1.weight&quot;, &quot;layer3.0.bn1.bias&quot;, &quot;layer3.0.bn1.running_mean&quot;, &quot;layer3.0.bn1.running_var&quot;, &quot;layer3.0.conv2.weight&quot;, &quot;layer3.0.bn2.weight&quot;, &quot;layer3.0.bn2.bias&quot;, &quot;layer3.0.bn2.running_mean&quot;, &quot;layer3.0.bn2.running_var&quot;, &quot;layer3.0.conv3.weight&quot;, &quot;layer3.0.bn3.weight&quot;, &quot;layer3.0.bn3.bias&quot;, &quot;layer3.0.bn3.running_mean&quot;, &quot;layer3.0.bn3.running_var&quot;, &quot;layer3.0.downsample.0.weight&quot;, &quot;layer3.0.downsample.1.weight&quot;, &quot;layer3.0.downsample.1.bias&quot;, &quot;layer3.0.downsample.1.running_mean&quot;, &quot;layer3.0.downsample.1.running_var&quot;, &quot;layer3.1.conv1.weight&quot;, &quot;layer3.1.bn1.weight&quot;, &quot;layer3.1.bn1.bias&quot;, &quot;layer3.1.bn1.running_mean&quot;, &quot;layer3.1.bn1.running_var&quot;, &quot;layer3.1.conv2.weight&quot;, &quot;layer3.1.bn2.weight&quot;, &quot;layer3.1.bn2.bias&quot;, &quot;layer3.1.bn2.running_mean&quot;, &quot;layer3.1.bn2.running_var&quot;, &quot;layer3.1.conv3.weight&quot;, &quot;layer3.1.bn3.weight&quot;, &quot;layer3.1.bn3.bias&quot;, &quot;layer3.1.bn3.running_mean&quot;, &quot;layer3.1.bn3.running_var&quot;, &quot;layer3.2.conv1.weight&quot;, &quot;layer3.2.bn1.weight&quot;, &quot;layer3.2.bn1.bias&quot;, &quot;layer3.2.bn1.running_mean&quot;, &quot;layer3.2.bn1.running_var&quot;, &quot;layer3.2.conv2.weight&quot;, &quot;layer3.2.bn2.weight&quot;, &quot;layer3.2.bn2.bias&quot;, &quot;layer3.2.bn2.running_mean&quot;, &quot;layer3.2.bn2.running_var&quot;, &quot;layer3.2.conv3.weight&quot;, &quot;layer3.2.bn3.weight&quot;, &quot;layer3.2.bn3.bias&quot;, &quot;layer3.2.bn3.running_mean&quot;, &quot;layer3.2.bn3.running_var&quot;, &quot;layer3.3.conv1.weight&quot;, &quot;layer3.3.bn1.weight&quot;, &quot;layer3.3.bn1.bias&quot;, &quot;layer3.3.bn1.running_mean&quot;, &quot;layer3.3.bn1.running_var&quot;, &quot;layer3.3.conv2.weight&quot;, &quot;layer3.3.bn2.weight&quot;, &quot;layer3.3.bn2.bias&quot;, &quot;layer3.3.bn2.running_mean&quot;, &quot;layer3.3.bn2.running_var&quot;, &quot;layer3.3.conv3.weight&quot;, &quot;layer3.3.bn3.weight&quot;, &quot;layer3.3.bn3.bias&quot;, &quot;layer3.3.bn3.running_mean&quot;, &quot;layer3.3.bn3.running_var&quot;, &quot;layer3.4.conv1.weight&quot;, &quot;layer3.4.bn1.weight&quot;, &quot;layer3.4.bn1.bias&quot;, &quot;layer3.4.bn1.running_mean&quot;, &quot;layer3.4.bn1.running_var&quot;, &quot;layer3.4.conv2.weight&quot;, &quot;layer3.4.bn2.weight&quot;, &quot;layer3.4.bn2.bias&quot;, &quot;layer3.4.bn2.running_mean&quot;, &quot;layer3.4.bn2.running_var&quot;, &quot;layer3.4.conv3.weight&quot;, &quot;layer3.4.bn3.weight&quot;, &quot;layer3.4.bn3.bias&quot;, &quot;layer3.4.bn3.running_mean&quot;, &quot;layer3.4.bn3.running_var&quot;, 
&quot;layer3.5.conv1.weight&quot;, &quot;layer3.5.bn1.weight&quot;, &quot;layer3.5.bn1.bias&quot;, &quot;layer3.5.bn1.running_mean&quot;, &quot;layer3.5.bn1.running_var&quot;, &quot;layer3.5.conv2.weight&quot;, &quot;layer3.5.bn2.weight&quot;, &quot;layer3.5.bn2.bias&quot;, &quot;layer3.5.bn2.running_mean&quot;, &quot;layer3.5.bn2.running_var&quot;, &quot;layer3.5.conv3.weight&quot;, &quot;layer3.5.bn3.weight&quot;, &quot;layer3.5.bn3.bias&quot;, &quot;layer3.5.bn3.running_mean&quot;, &quot;layer3.5.bn3.running_var&quot;, &quot;layer4.0.conv1.weight&quot;, &quot;layer4.0.bn1.weight&quot;, &quot;layer4.0.bn1.bias&quot;, &quot;layer4.0.bn1.running_mean&quot;, &quot;layer4.0.bn1.running_var&quot;, &quot;layer4.0.conv2.weight&quot;, &quot;layer4.0.bn2.weight&quot;, &quot;layer4.0.bn2.bias&quot;, &quot;layer4.0.bn2.running_mean&quot;, &quot;layer4.0.bn2.running_var&quot;, &quot;layer4.0.conv3.weight&quot;, &quot;layer4.0.bn3.weight&quot;, &quot;layer4.0.bn3.bias&quot;, &quot;layer4.0.bn3.running_mean&quot;, &quot;layer4.0.bn3.running_var&quot;, &quot;layer4.0.downsample.0.weight&quot;, &quot;layer4.0.downsample.1.weight&quot;, &quot;layer4.0.downsample.1.bias&quot;, &quot;layer4.0.downsample.1.running_mean&quot;, &quot;layer4.0.downsample.1.running_var&quot;, &quot;layer4.1.conv1.weight&quot;, &quot;layer4.1.bn1.weight&quot;, &quot;layer4.1.bn1.bias&quot;, &quot;layer4.1.bn1.running_mean&quot;, &quot;layer4.1.bn1.running_var&quot;, &quot;layer4.1.conv2.weight&quot;, &quot;layer4.1.bn2.weight&quot;, &quot;layer4.1.bn2.bias&quot;, &quot;layer4.1.bn2.running_mean&quot;, &quot;layer4.1.bn2.running_var&quot;, &quot;layer4.1.conv3.weight&quot;, &quot;layer4.1.bn3.weight&quot;, &quot;layer4.1.bn3.bias&quot;, 
&quot;layer4.1.bn3.running_mean&quot;, &quot;layer4.1.bn3.running_var&quot;, &quot;layer4.2.conv1.weight&quot;, &quot;layer4.2.bn1.weight&quot;, &quot;layer4.2.bn1.bias&quot;, &quot;layer4.2.bn1.running_mean&quot;, &quot;layer4.2.bn1.running_var&quot;, &quot;layer4.2.conv2.weight&quot;, &quot;layer4.2.bn2.weight&quot;, &quot;layer4.2.bn2.bias&quot;, &quot;layer4.2.bn2.running_mean&quot;, &quot;layer4.2.bn2.running_var&quot;, &quot;layer4.2.conv3.weight&quot;, &quot;layer4.2.bn3.weight&quot;, &quot;layer4.2.bn3.bias&quot;, &quot;layer4.2.bn3.running_mean&quot;, &quot;layer4.2.bn3.running_var&quot;, &quot;fc.weight&quot;, &quot;fc.bias&quot;.
        Unexpected key(s) in state_dict: &quot;meta&quot;, &quot;state_dict&quot;, &quot;optimizer&quot;.

what should I do?
I just want to make some cloth attribute predicting web app with pretrained model (mmfashion https://github.com/open-mmlab/mmfashion/blob/master/docs/MODEL_ZOO.md)
but I fail to use pretrained model.

Lets say if you downloaded weights for wide_resnet50_2 and you performing same task that the weights you downloaded trained then:
import torchvision
model = torchvision.models.wide_resnet50_2(pretrained=True)

for param in model.parameters():
    param.required_grad = False

and then the parameters you downloaded can be load as:
Load model state dict
model.load_state_dict(torch.load('./C:/venvs/ai/aiproduct/latest.pth')) # path of your weights
model.eval()
model.cuda()

