From 9f5895cb7a7db8248295038543d75a4334ee5c44 Mon Sep 17 00:00:00 2001 From: Quentin Anthony Date: Thu, 21 Jul 2022 15:27:04 -0700 Subject: [PATCH] fix issue in accelerate. (#2121) Co-authored-by: Ammar Ahmad Awan --- deepspeed/comm/torch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deepspeed/comm/torch.py b/deepspeed/comm/torch.py index 17802c2e03ef..f7731536b696 100644 --- a/deepspeed/comm/torch.py +++ b/deepspeed/comm/torch.py @@ -35,9 +35,10 @@ def __init__(self, backend, timeout, init_method, name='torch'): self.init_process_group(backend, timeout, init_method) def init_process_group(self, backend, timeout, init_method): - return torch.distributed.init_process_group(backend, - timeout=timeout, - init_method=init_method) + if not torch.distributed.is_initialized(): + torch.distributed.init_process_group(backend, + timeout=timeout, + init_method=init_method) def all_reduce(self, tensor,