When i set device to "cpu" in settings_eval.ini, just to test cpu performance, i get:
Traceback (most recent call last):
File "run.py", line 187, in
evaluate_bulk(settings_eval['EVAL_BULK'])
File "run.py", line 136, in evaluate_bulk
mc_samples)
File "/home/diedre/git/quickNAT_pytorch/utils/evaluator.py", line 260, in evaluate
model.cuda(device)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 311, in cuda
return self._apply(lambda t: t.cuda(device))
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 208, in _apply
module._apply(fn)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 208, in _apply
module._apply(fn)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 230, in _apply
param_applied = fn(param)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 311, in
return self._apply(lambda t: t.cuda(device))
RuntimeError: Invalid device, must be cuda device
Seems like an easy fix, change of using model.cuda(device)
to model.to(device)
, with device being redefined as something like:
torch.device("cpu") if device == "cpu" else torch.device("cuda:{}".format(device))
I also tested cpu, and got:
Traceback (most recent call last):
File "run.py", line 186, in
settings_eval = Settings('settings_eval.ini')
File "/home/diedre/git/quickNAT_pytorch/settings.py", line 10, in init
self.settings_dict = _parse_values(config)
File "/home/diedre/git/quickNAT_pytorch/settings.py", line 27, in _parse_values
config_parsed[section][key] = ast.literal_eval(value)
File "/usr/lib/python3.6/ast.py", line 85, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python3.6/ast.py", line 84, in _convert
raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: <_ast.Name object at 0x7f13134c55c0>
The code probably expects an int or string.