Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to only show progress bar of the master node of tqdm in distributed training?

Tags:

pytorch

tqdm

tqdm flushes a lot in distributed training setting (torch.distributed.run) Is there a way to only display the bar from master node?

like image 724
Mr.cysl Avatar asked Oct 21 '25 17:10

Mr.cysl


1 Answers

You can switch it off by setting disable=True parameter for non-master processes, for example:

# ...
    
master_process = ddp_rank == 0

# ...
    
for epoch in range(epoch_num):
  with tqdm(dataloader, disable=not master_process) as pbar:    
    # ...
like image 138
Cyprian Avatar answered Oct 23 '25 07:10

Cyprian