Hi All,
I am training a model on the gpu and after each epoch I would like to store the best models on the cpu. Does model.to(‘cpu’) create a copy on the cpu and does it keep the original model on the gpu?
At the moment, I have this code:
best_model = copy.deepcopy(model)
best_model = best_model.to(‘cpu’)
The problem is that this code makes a copy first on the gpu, and then it transfers the copy to the cpu. I would like to avoid making a copy on the gpu, since I don’t have enough gpu memory.
Simone