Loading a pre-trained model on CPU while had been trained on multiple GPUS

Hi

I load a model and pass it into CPU. Some modules of this model have been wrapped by data parallel on 4 GPUs during the training phase. Now, in the test phase when I pass both model and input into the CPU and when I feed the model with the input, I get the following error.

How can I work with a model in CPU when it has been trained on 4 GPUs during the training phase?

Thanks

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu

You could store the state_dict of the internal .module as described here and then use map_location to load it onto the CPU as described here.

Thank you @ptrblck for your reply. Is there any way to load on CPU for the model already trained? because the link you have shared mean that I should run my program again to be trained. Am I right?