Unable to load weights created in CUDA into CPU

I have a .pt file of a model I trained in the libtorch CUDA backend. I now tried to load this model on another machine which does not support CUDA using

torch::load(model, “model.pt”);

throws the c10::Error

Could not run ‘aten::empty_strided’ with arguments from the ‘CUDA’ backend.

Any ideas?

Hi Timangar. I’m not familiar with c++ but looking at the docs torch::load() should call load_from which allows to specify the device through the parameter device. Maybe this can help!

1 Like