How To Swap From Gpu To A Cpu Only?
Hi I was wondering how can run a machine learning code onto my CPU instead of a GPU? I have tried making the GPU false on the setting file but it hasn't been able to fix it. ###
Solution 1:
If I am not wrong, you are getting the above error at code model = loadmodel()
. I don't have an idea what you are doing inside loadmodel()
, but you can try below points:
- Set
defaults.device
tocpu
. To be completely sure, add atorch.cuda.set_device('cpu')
- Change
torch.load(model_weights)
totorch.load(model_weights, map_location=torch.device('cpu'))
Post a Comment for "How To Swap From Gpu To A Cpu Only?"