I am getting the above error when I am running the the same code on different machine
Kindly help!!
I trained the model on gpu machine and then testing it on cpu machine only (is this the issue do I need to retrain the model on cpu)
AttributeError Traceback (most recent call last)
in
33
34 start = datetime.datetime.now()
—> 35 inp, out, lab, pred, paths = predict_test_paths(model, dataloaders=dataloaders)
36 end = datetime.datetime.now()
37
in predict_test_paths(model, dataloaders, device_type)
126 labels = labels.to(device)
127
–> 128 outputs = model(inputs)
129 _, preds = torch.max(outputs, 1)
130
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
–> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py in forward(self, *inputs, **kwargs)
141
142 for t in chain(self.module.parameters(), self.module.buffers()):
–> 143 if t.device != self.src_device_obj:
144 raise RuntimeError("module must have its parameters and buffers "
145 "on device {} (device_ids[0]) but found one of "
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in getattr(self, name)
574 return modules[name]
575 raise AttributeError("’{}’ object has no attribute ‘{}’".format(
–> 576 type(self).name, name))
577
578 def setattr(self, name, value):
AttributeError: ‘DataParallel’ object has no attribute ‘src_device_obj’