Can anyone tell me what is wrong here

Traceback (most recent call last):
File “train.py”, line 124, in
main()
File “train.py”, line 119, in main
model.to(device)
File “/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 393, in to
return self._apply(lambda t: t.to(device))
File “/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 176, in _apply
module._apply(fn)
File “/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 176, in _apply
module._apply(fn)
File “/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 182, in _apply
param.data = fn(param.data)
File “/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 393, in
return self._apply(lambda t: t.to(device))
TypeError: to() received an invalid combination of arguments - got (bool), but expected one of:

  • (torch.device device, torch.dtype dtype)
  • (torch.dtype dtype)
    didn’t match because some of the arguments have invalid types: (bool)
  • (Tensor other)
    didn’t match because some of the arguments have invalid types: (bool)

Could you print the type of device?
Apperently its type is bool, while you are probably trying to move your model to GPU?
If so, try device = 'cuda'.

worked just fine :slight_smile:

thnx