[hotfix] fix torch 2.0 compatibility (#4936)

* [hotfix] fix launch

* [test] fix test gemini optim

* [shardformer] fix vit
This commit is contained in:
Hongxin Liu
2023-10-18 11:05:25 +08:00
committed by GitHub
parent 21ba89cab6
commit 1f5d2e8062
6 changed files with 39 additions and 55 deletions

View File

@@ -31,7 +31,7 @@ class PyTorchProcessGroupDict(metaclass=SingletonMeta):
return self.dict[processgroup_key]
PYTORCHPGDICT_ = PyTorchProcessGroupDict()
PYTORCHPGDICT_ = None
class ProcessGroup:
@@ -59,6 +59,9 @@ class ProcessGroup:
if not torch.distributed.is_initialized():
self.is_init = False
return
global PYTORCHPGDICT_
if PYTORCHPGDICT_ is None:
PYTORCHPGDICT_ = PyTorchProcessGroupDict()
assert torch.distributed.is_initialized(), f"ProcessGroup must be used after distributed initialized"