PySyft
PySyft copied to clipboard
RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 'self' in call to _th_set_
Description
A clear and concise description of what you want to test.
Type of Test
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 20, 5, 1)
self.conv2 = nn.Conv2d(20, 50, 5, 1)
self.fc1 = nn.Linear(4*4*50, 500)
self.fc2 = nn.Linear(500, 10)
def forward(self, x):
x = F.relu(self.conv1(x))
...
x = self.fc2(x)
return F.log_softmax(x, dim=1)
model = Net().to(device)
I would like to modify this model by a pretrained resnet :
model = models.resnet50(pretrained=True)
model.to(device)
But its triggers:
RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 'self' in call to _th_set_
The error was in model.get() How can I solve this pb. Thks
same question. When I use device = torch.device("cpu")
this error would disappear. This could be because PySyft may have some compatibility issues with PyTorch’s CUDA functionality, and it may not allow you to move your tensors and models to the GPU device.
@aynesss what version of Syft are you using?
Closing for now.