correction for get rank id. (#507)

* Fix no attribute 'data' error.

* minor fixes

* correction for get rank id.
This commit is contained in:
Lucky Wong 2022-07-29 11:28:52 +08:00 committed by GitHub
parent ec69967584
commit 34b4356bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,9 +57,9 @@ def get_rank():
if "RANK" in os.environ: if "RANK" in os.environ:
return int(os.environ["RANK"]) return int(os.environ["RANK"])
elif dist.is_available() and dist.is_initialized(): elif dist.is_available() and dist.is_initialized():
return dist.rank() return dist.get_rank()
else: else:
return 1 return 0
def get_local_rank(): def get_local_rank():