The error is related to DDP initialization, not model loading.
You should initialize a distributed process group before creating a DDP module.
As you said you already trained your model with DDP, maybe the dist.init_process_group function moved to somewhere unwanted.


When loading model parameters after you create DDP model, it is safe to load parameters on all processes.


If you want to get a general feeling of DDP code, you can refer to this DDP setup 4 and model definition 4 example. See how state_dict, save, load, parallelize functions are defined.