I am implementing these exact same lines of code, but I get an error.
Code : (On a different computer, with GPU)


model = Classifier()
… training…
torch.save(model.state_dict(), ‘./model_Q2.pth’)


Code: (on my laptop)


model = Classifier()
model.load_state_dict(torch.load(’./model_Q2.pth’))


Error : module ‘torch._C’ has no attribute ‘_cuda_getDevice’
Note : I trained my model with cuda = True on a virtual environment on a network (with GPUs), but I want to evaluate my model on my laptop.
I believe we need to ‘switch off’ the cuda before saving.
Could you help?