Download utils/distributed_utils.py from BonanDing/WorldMem_Repro: direct link, hf CLI and curl.
- Browser
- Download file 378 Bytes
-
https://huggingface.co/BonanDing/WorldMem_Repro/resolve/main/utils/distributed_utils.py
- Command line
-
hf download hf://BonanDing/WorldMem_Repro/utils/distributed_utils.py
-
curl -L -o distributed_utils.py https://huggingface.co/BonanDing/WorldMem_Repro/resolve/main/utils/distributed_utils.py
378 Bytes
| import os | |
| # Check standard environment variables for distributed training | |
| # Default to True (rank 0) if not in a distributed environment | |
| _rank = int(os.environ.get("RANK", 0)) | |
| _local_rank = int(os.environ.get("LOCAL_RANK", 0)) | |
| # We consider it rank zero if global rank is 0. | |
| # Local rank check is usually redundant if rank is 0, but good for sanity. | |
| is_rank_zero = _rank == 0 | |