-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key mismatch while loading the model? #28
Comments
following code before loading the checkpoint solved the issue
|
Dear @Jumabek, import torch
import torch.backends.cudnn as cudnn
from models.fpnssd.net import FPNSSD512
# Print the PyTorch Version:
print(torch.__version__) # 0.4.0
# *************** Parameters **************** #
# Check use GPU or not
use_gpu = torch.cuda.is_available() # use GPU
if use_gpu:
device = torch.device("cuda:0")
else:
device = torch.device("cpu")
# ** Loading Pre-Trained Weights:
net = FPNSSD512(num_classes=20).to(device)
net = torch.nn.DataParallel(net)
cudnn.benchmark = True
# download pre-trained weights from:
# https://drive.google.com/open?id=1yy_kUnm_hZR3uk9yLcaQSMwxVn7wApTU
net.load_state_dict(torch.load('./fpnssd512_20_trained.pth'))
net.eval() However, I got your reported error. Would you please help me to address this issue? |
Dear @kuangliu, |
@ahkarami sorry for late reply.
|
Dear @Jumabek,
It is worth nothing that I have tested the above code on a system which has just one GTX 1080ti GPU (with CUDA 9.0 & cuDNN 7). |
Hi I followed your code and seems helped me solve the issue of unexpected key, |
@ahkarami I meet the same issue with you. Have you fixed it now? |
Dear @zacario-li, |
If you want to load the weights after |
|
Dear @silkylove, |
|
Thank you very much @silkylove. |
@ahkarami |
Dear @silkylove, |
@silkylove, |
I am having issue loading the trained checkpoint to FPNSSD512 model.
How can I fix that?
The text was updated successfully, but these errors were encountered: