From 189217225189505e82479c8acc2d2ecbaa6344f8 Mon Sep 17 00:00:00 2001 From: Ananth Date: Fri, 17 Oct 2025 15:05:28 +0530 Subject: [PATCH] chore: updated is_ddp to use more robust checks Refactor is_ddp function to check whether ddp is being used or not --- nanochat/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanochat/common.py b/nanochat/common.py index 8b10df9..48f225f 100644 --- a/nanochat/common.py +++ b/nanochat/common.py @@ -76,8 +76,8 @@ def print_banner(): print0(banner) def is_ddp(): - # TODO is there a proper way - return int(os.environ.get('RANK', -1)) != -1 + # check if DDP is available and initialized + return dist.is_available() and dist.is_initialized() def get_dist_info(): if is_ddp():