# Getting a eError: Default process group has not been initialized, please make sure to call init\_process\_group

**URL:** <https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513>\
**Category:** Uncategorized\
**Created:** [March 17, 2020, 11:16am UTC](https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513 "2020-03-17T11:16:35Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [April 1, 2023, 1:26am UTC](https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513/22 "2023-04-01T01:26:00Z")

</div>

Why would you have to train the model again if you save `baseline`’s `state_dict`? You would be able to create the `baseline` model afterwards and load its `state_dict`, wouldn’t you?

---

<div class="post-metadata">

**Author:** ![winchest](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/w/ecae2f/32.png) [@winchest](https://discuss.pytorch.org/u/winchest)\
**Post date:** [April 1, 2023, 3:00am UTC](https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513/24 "2023-04-01T03:00:12Z")

</div>

Thanks for your reply again! I might didn’t explain it clearly.  
I save the baseline through this function in train.py:

```auto
torch.save(
                {
                    'model': get_inner_model(model).state_dict(),
                    'optimizer': optimizer.state_dict(),
                    'rng_state': torch.get_rng_state(),
                    'cuda_rng_state': torch.cuda.get_rng_state_all(),
                    'baseline': baseline.state_dict()
                },
                os.path.join(opts.save_dir, 'epoch-{}.pt'.format(epoch))

```

As you can see, I save the baseline through `baseline.state_dict()` but the `state_dict()` here is defined by the baseline class itself which is:

```auto
    def state_dict(self):
        return {
            'model': self.model,
            'dataset': self.dataset,
            'epoch': self.epoch
        }

```

Therefore the “pt” document I have now include a whole model(the baseline part ) and the parameters (the model part). When I try to evaluate the model, I load the model part through:

```auto
load_data = torch_load_cpu(model_filename)
def torch_load_cpu(load_path):
    return torch.load(load_path, map_location=lambda storage, loc: storage)
model.load_state_dict({**model.state_dict(),**load_data.get('model', {})})

```

But when it runs to `torch_load_cpu()`, because of the baseline whole model part, I get the error: “RuntimeError: Default process group has not been initialized, please make sure to call init\_process\_group.”  
So I was wonder if there is a way to only load the model part.

> [ptrblck](https://discuss.pytorch.org/u/ptrblck)
> 
> [1h](https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513/22)
> 
> Why would you have to train the model again if you save `baseline`’s `state_dict`? You would be able to create the `baseline` model afterwards and load its `state_dict`, wouldn’t you?

Right now the ‘pt’ document I have only has `baseline`’s whole model.

[Previous page](https://discuss.pytorch.org/t/getting-a-eerror-default-process-group-has-not-been-initialized-please-make-sure-to-call-init-process-group/73513.md?page=1)
