diff --git a/utils/loggers/__init__.py b/utils/loggers/__init__.py index 027cef4d283a..603837d57052 100644 --- a/utils/loggers/__init__.py +++ b/utils/loggers/__init__.py @@ -48,12 +48,12 @@ def start(self): self.tb = SummaryWriter(str(s)) # W&B - try: - assert 'wandb' in self.include and wandb - run_id = torch.load(self.weights).get('wandb_id') if self.opt.resume else None + if wandb and 'wandb' in self.include: + wandb_artifact_resume = isinstance(self.opt.resume, str) and self.opt.resume.startswith('wandb-artifact://') + run_id = torch.load(self.weights).get('wandb_id') if self.opt.resume and not wandb_artifact_resume else None self.opt.hyp = self.hyp # add hyperparameters self.wandb = WandbLogger(self.opt, run_id) - except: + else: self.wandb = None return self diff --git a/utils/loggers/wandb/wandb_utils.py b/utils/loggers/wandb/wandb_utils.py index ba2d830df07b..c978e3ea838d 100644 --- a/utils/loggers/wandb/wandb_utils.py +++ b/utils/loggers/wandb/wandb_utils.py @@ -158,11 +158,12 @@ def __init__(self, opt, run_id, job_type='Training'): self.data_dict = check_dataset(opt.data) self.setup_training(opt) - # write data_dict to config. useful for resuming from artifacts if not self.wandb_artifact_data_dict: self.wandb_artifact_data_dict = self.data_dict - self.wandb_run.config.update({'data_dict': self.wandb_artifact_data_dict}, - allow_val_change=True) + # write data_dict to config. useful for resuming from artifacts. Do this only when not resuming. + if not opt.resume: + self.wandb_run.config.update({'data_dict': self.wandb_artifact_data_dict}, + allow_val_change=True) if self.job_type == 'Dataset Creation': self.data_dict = self.check_and_upload_dataset(opt)