Using torch data prallel. Invalid device string

I’m trying to use the torch dataparallel class with specified GPU devices. When I set the torch.device as torch.device(“cuda:0,1”). Pytorch gives me the following error: RuntimeError: Invalid device string: ‘cuda:0,1’.

I have two GPU devices on my machine. Using Windows 10 OS.

I will look forward to any suggestions.

torch.device does not accept multiple devices. Check the docs and specify the GPU ids in the DataParallel initialization (or better: use DistributedDataParallel for better performance).

1 Like