Closed zxfly2 closed 6 years ago
I guess so. May be you can load the model by: pretrain = torch.load(opt.pretrain_path, map_location=lambda storage, loc: storage)
Thank you for your reply. I have tried this load method before but it still can't run normally.And I got the following tips:
raceback (most recent call last):
File "/home/user/python_project/Python学习2/Facial-Expression-Recognition/visualize.py", line 51, in
Process finished with exit code 1
Have you successfully run on a CPU-only device before?
Thank you for your advice, my problem has been solved.After commenting out the code with .cuda( ), I can run successfully on a CPU-only device.
Thank you for your advice, my problem has been solved.After commenting out the code with .cuda( ), I can run successfully on a CPU-only device.
could you tell me how do you realize it specifically?
Just comment out the code with .cuda( ) in viusalize.py file,such as:
net = VGG('VGG19') checkpoint = torch.load(os.path.join('FER2013_VGG19', 'PrivateTest_model.t7')) net.load_state_dict(checkpoint['net']) net.cuda() net.eval()
you can comment out the net.cuda( )
Can the code run on a CPU-only device? I am getting an error when running python visualize.py on a CPU-only device.