If you create a dataparallel model as shown here and then save it as shown here. Are you required to do nn.DataParallel(model)
again to load the model and continue training?
No. If you store the state_dict
from the model directly or model.modules
in case you are using nn.DataParallel
, you should be able to reload it into the model again.
I think you will have to do nn.DataParallel
since you will do model.module.load_state_dict(checkpoint['model_state_dict'])
and for the model to have module you need model = nn.DataParallel(model)