henry000 commited on
Commit
ed7d166
·
1 Parent(s): 360e5d7

🎨 [Fix] logging bugs, only log on rank0 gpu

Browse files
yolo/tools/solver.py CHANGED
@@ -121,7 +121,7 @@ class ModelTrainer:
121
  checkpoint["model_state_dict_ema"] = self.model.state_dict()
122
  self.ema.restore()
123
 
124
- print(f"💾 success save at {file_path}")
125
  torch.save(checkpoint, file_path)
126
 
127
  def good_epoch(self, mAPs: Dict[str, Tensor]) -> bool:
 
121
  checkpoint["model_state_dict_ema"] = self.model.state_dict()
122
  self.ema.restore()
123
 
124
+ logger.info(f"💾 success save at {file_path}")
125
  torch.save(checkpoint, file_path)
126
 
127
  def good_epoch(self, mAPs: Dict[str, Tensor]) -> bool:
yolo/utils/logging_utils.py CHANGED
@@ -89,14 +89,14 @@ class ProgressLogger(Progress):
89
  super().__init__(*args, *progress_bar, **kwargs)
90
 
91
  self.use_wandb = cfg.use_wandb
92
- if self.use_wandb:
93
  wandb.errors.term._log = custom_wandb_log
94
  self.wandb = wandb.init(
95
  project="YOLO", resume="allow", mode="online", dir=self.save_path, id=None, name=exp_name
96
  )
97
 
98
  self.use_tensorboard = cfg.use_tensorboard
99
- if self.use_tensorboard:
100
  from torch.utils.tensorboard import SummaryWriter
101
 
102
  self.tb_writer = SummaryWriter(log_dir=self.save_path / "tensorboard")
 
89
  super().__init__(*args, *progress_bar, **kwargs)
90
 
91
  self.use_wandb = cfg.use_wandb
92
+ if self.use_wandb and self.local_rank == 0:
93
  wandb.errors.term._log = custom_wandb_log
94
  self.wandb = wandb.init(
95
  project="YOLO", resume="allow", mode="online", dir=self.save_path, id=None, name=exp_name
96
  )
97
 
98
  self.use_tensorboard = cfg.use_tensorboard
99
+ if self.use_tensorboard and self.local_rank == 0:
100
  from torch.utils.tensorboard import SummaryWriter
101
 
102
  self.tb_writer = SummaryWriter(log_dir=self.save_path / "tensorboard")