Closed zhangyunming closed 3 years ago
Hi. Thanks for your attention.
Our pre-trained models are wrapped by nn.DataParallel. For your problem, you may need to load the ckpt file by using:
model.load_state_dict(torch.load(args.ckpt_path, map_location=torch.device('cpu'))['module'])
Thank you for pointing it out. We will soon improve the code to make it compatible with cpu.
###for cpu
modnet = MODNet(backbone_pretrained=False)
modnet = nn.DataParallel(modnet)
modnet.load_state_dict(torch.load(args.ckpt_path,map_location=torch.device('cpu')))
modnet.eval()
just ok above. i delete modnet = nn.DataParallel(modnet).
thanks
Yes. This is another solution. Good job :)
hi, because there is no GPU on my windows pc, so i change the GPU to cpu by :
and chang the code in imagematting/inference.py line 98: , _, matte = modnet(im.cpu(), inference=False)
but error occured as:
my torch-cpu=1.6.0 thanks.