Abstractions
ILogger
Provides logging capabilities to the derived class.
Source code in common/abstractions/abstract_logger.py
22 23 24 25 26 27 28 29 |
|
is_non_linux_dataloader_worker_process()
Check if current process is a dataloader worker process on a non linux device.
Source code in common/abstractions/mute_processes.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
mute_current_process()
Mute prints, warnings and all logs except ERRORS. This is meant when running multiple processes.
Source code in common/abstractions/mute_processes.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
mute_non_linux_dataloader_worker_process()
Mute any worker process when running on mac/windows. This is required because the dataloader workers are "spawned" on mac/windows and "forked" on linux. The consequence being that the on mac/windows every module will be imported on each worker process, leading to a huge number of prints/logs that are displayed on import. For more information: https://pytorch.org/docs/stable/data.html#platform-specific-behaviors
To avoid this, we mute the dataloader workers when running on mac/windows.
Note: We assume that the process tree looks like this: Without DDP: ... -> main_process -> worker_process With DDP: ... -> main_process -> node_process -> worker_process
Knowing that depending on how the script is launched, main_process might be child of other non "python" processes such as:
ssh(non-python) -> pycharm(non-python) -> main_process(python) -> ...
Source code in common/abstractions/mute_processes.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
mute_subprocesses()
Mute (prints, warnings and all logs except ERRORS) of some subprocesses to avoid having duplicates in the logs.
Source code in common/abstractions/mute_processes.py
10 11 12 13 14 15 16 17 |
|