在使用模型进行二进制分类预测的一天中,我的cronjobs突然运行平稳,发生了此错误。
AttributeError Traceback (most recent call last)
<ipython-input-1-ed7c514b23c2> in <module>()
312
313 start = datetime.datetime.now()
--> 314 inp, out, lab, pred, paths = predict_test_paths(model,
dataloaders=dataloaders)
315 end = datetime.datetime.now()
316
<ipython-input-1-ed7c514b23c2> in predict_test_paths(model, dataloaders,
device_type)
259 labels = labels.to(device)
260
--> 261 outputs = model(inputs)
262 _, preds = torch.max(outputs, 1)
263
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in
__call__(self, *input, **kwargs)
491 result = self._slow_forward(*input, **kwargs)
492 else:
--> 493 result = self.forward(*input, **kwargs)
494 for hook in self._forward_hooks.values():
495 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.6/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.6/site-packages/torch/nn/modules/module.py in
__getattr__(self, name)
537 return modules[name]
538 raise AttributeError("'{}' object has no attribute
'{}'".format(
--> 539 type(self).__name__, name))
540
541 def __setattr__(self, name, value):
AttributeError: 'DataParallel' object has no attribute 'src_device_obj'
请帮助,因为这非常重要,我需要尽快解决此问题