From 586a8abc0673a71f1d22d5399515406d6da83b46 Mon Sep 17 00:00:00 2001 From: Zach Nussbaum Date: Tue, 25 Apr 2023 20:34:12 +0000 Subject: [PATCH] fix: allow for print for fns that are used in both dist and single --- gpt4all/utils/distributed_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gpt4all/utils/distributed_utils.py b/gpt4all/utils/distributed_utils.py index 839a7a92..3fcf276f 100644 --- a/gpt4all/utils/distributed_utils.py +++ b/gpt4all/utils/distributed_utils.py @@ -2,5 +2,8 @@ import torch.distributed as dist def rank0_print(msg): - if dist.get_rank() == 0: + if dist.is_initialized(): + if dist.get_rank() == 0: + print(msg) + else: print(msg)