Open justmaulik opened 4 years ago
I have the same issue and I solve this by adding a simple if...else..
statement to all the .cude
parameters in the pix2pixHD_model.py.
For example, replace
inst_map = inst_map.data.cuda()
by
if not self.gpu_ids: inst_map = inst_map.data else: inst_map = inst_map.data.cuda()
.
Another alternative that in my opinion is cleaner is to add an instance variable called device
in BaseModel.initialize
like this
self.device = torch.device("cuda:0" if torch.cuda.is_available() and self.gpu_ids else "cpu")
That allows you to simply replace all occurrences of .cuda()
with .to(device)
in pix2pixHD_model.py
. No need to wrap in if/else 🙌🏼
I am also facing the same issue. And I also try this methods but it didn't work for me. Can you help me with the solution of train model on cpu.
你好,邮件已收到,祝你万事如意,生活愉快!
When Using --gpu_ids =-1 for cpu it gives below error but works smooth with gpu can anyone please give some highlight on this as i need to get the onnx export and then use with onnx on cpu.
Execution Command