Skip to content

Commit fa404ea

Browse files
author
bghira
committed
update logging check for args parser
1 parent f2fc3bf commit fa404ea

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

helpers/arguments.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
from helpers.training.state_tracker import StateTracker
44

55
logger = logging.getLogger("ArgsParser")
6-
# Are we the main process?
7-
if __name__ == "__main__":
8-
logger.setLevel(os.environ.get("SIMPLETUNER_LOG_LEVEL", "INFO"))
9-
else:
10-
logger.setLevel("ERROR")
6+
# Are we the primary process?
7+
is_primary_process = True
8+
if os.environ.get("RANK") is not None:
9+
if int(os.environ.get("RANK")) != 0:
10+
is_primary_process = False
11+
logger.setLevel(
12+
os.environ.get("SIMPLETUNER_LOG_LEVEL", "INFO" if is_primary_process else "ERROR")
13+
)
1114

1215
if torch.cuda.is_available():
1316
os.environ["NCCL_SOCKET_NTIMEO"] = "2000000"

0 commit comments

Comments
 (0)