Don't do wandb except on rank 0

This commit is contained in:
James Betker 2021-06-06 16:52:07 -06:00
parent 7c5478bc2c
commit 2ad2b56438
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ class Trainer:
self.opt = opt
#### wandb init
if opt['wandb']:
if opt['wandb'] and self.rank <= 0:
import wandb
os.makedirs(os.path.join(opt['path']['log'], 'wandb'), exist_ok=True)
wandb.init(project=opt['name'], dir=opt['path']['log'])
@ -193,7 +193,7 @@ class Trainer:
# tensorboard logger
if opt['use_tb_logger'] and 'debug' not in opt['name']:
self.tb_logger.add_scalar(k, v, self.current_step)
if opt['wandb']:
if opt['wandb'] and self.rank <= 0:
import wandb
wandb.log(logs)
self.logger.info(message)

View File

@ -70,7 +70,7 @@ class ExtensibleTrainer(BaseModel):
if not net['trainable']:
new_net.eval()
if net['wandb_debug']:
if net['wandb_debug'] and self.rank <= 0:
import wandb
wandb.watch(new_net, log='all', log_freq=3)