RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
Traceback:
File "/data/User/ch/CNN/view/image_app.py", line 80, in matting_view
alpha = matting.predict(image, trimap)
File "/root/anaconda3/lib/python3.7/site-packages/graphics/function/Matting.py", line 81, in predict
outputs = self.net(inputs).squeeze().cpu().data.numpy()
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 146, in forward
"them on device: {}".format(self.src_device_obj, t.device))
Inferrence on the CPU is slow. You need to transfer the weight to CPU. I should have commented a line of code where model is loaded. Please double check.
RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu Traceback: File "/data/User/ch/CNN/view/image_app.py", line 80, in matting_view alpha = matting.predict(image, trimap) File "/root/anaconda3/lib/python3.7/site-packages/graphics/function/Matting.py", line 81, in predict outputs = self.net(inputs).squeeze().cpu().data.numpy() File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 146, in forward "them on device: {}".format(self.src_device_obj, t.device))