Check if the current process is the main process.
()
| 31 | |
| 32 | |
| 33 | def is_main_process() -> bool: |
| 34 | """Check if the current process is the main process.""" |
| 35 | return not dist.is_initialized() or dist.get_rank() == 0 |
| 36 | |
| 37 | |
| 38 | def print_on_main_process(msg: str) -> None: |