Hey guys I tried this. anybody can identify whats the error??
model.to(device)
modelCheckpoint = torch.load("…/models/model_final_new_custom.pt")
for key in modelCheckpoint:
print(key)
model.load_state_dict(modelCheckpoint[‘state_dict’].items())
model = model.module.Net.features
model.eval()
weights = list(model.parameters())
the output and error i got:
conv1.weight
conv1.bias
conv2.weight
conv2.bias
bn2.weight
bn2.bias
bn2.running_mean
bn2.running_var
bn2.num_batches_tracked
conv3.weight
conv3.bias
bn3.weight
bn3.bias
bn3.running_mean
bn3.running_var
bn3.num_batches_tracked
conv4.weight
conv4.bias
bn4.weight
bn4.bias
bn4.running_mean
bn4.running_var
bn4.num_batches_tracked
fc1.weight
fc1.bias
fbn1.weight
fbn1.bias
fbn1.running_mean
fbn1.running_var
fbn1.num_batches_tracked
fc2.weight
fc2.bias
fbn2.weight
fbn2.bias
fbn2.running_mean
fbn2.running_var
fbn2.num_batches_tracked
fc3.weight
fc3.bias

KeyError                                  Traceback (most recent call last)
 in 
8 for key in modelCheckpoint:
9     print(key)
—> 10 model.load_state_dict(modelCheckpoint[‘state_dict’].items())
11 model = model.module.Net.features
12 model.eval()
KeyError: ‘state_dict’