W&B: More improvements and refactoring (#4205)

* Improve docstrings and run names

* default wandb login prompt with timeout

* return key

* Update api_key check logic

* Properly support zipped dataset feature

* update docstring

* Revert tuorial change

* extend changes to log_dataset

* add run name

* bug fix

* bug fix

* Update comment

* fix import check

* remove unused import

* Hardcore .yaml file extension

* reduce code

* Reformat using pycharm

* Remove redundant try catch

* More refactoring and bug fixes

* retry

* Reformat using pycharm

* respect LOGGERS include list

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Ayush Chaurasia 2021-07-29 02:55:15 +05:30 committed by GitHub
parent e016b15555
commit 750465edae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -48,12 +48,12 @@ class Loggers():
self.tb = SummaryWriter(str(s)) self.tb = SummaryWriter(str(s))
# W&B # W&B
try: if wandb and 'wandb' in self.include:
assert 'wandb' in self.include and wandb 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 else None 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.opt.hyp = self.hyp # add hyperparameters
self.wandb = WandbLogger(self.opt, run_id) self.wandb = WandbLogger(self.opt, run_id)
except: else:
self.wandb = None self.wandb = None
return self return self

View File

@ -158,9 +158,10 @@ class WandbLogger():
self.data_dict = check_dataset(opt.data) self.data_dict = check_dataset(opt.data)
self.setup_training(opt) self.setup_training(opt)
# write data_dict to config. useful for resuming from artifacts
if not self.wandb_artifact_data_dict: if not self.wandb_artifact_data_dict:
self.wandb_artifact_data_dict = self.data_dict self.wandb_artifact_data_dict = self.data_dict
# 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}, self.wandb_run.config.update({'data_dict': self.wandb_artifact_data_dict},
allow_val_change=True) allow_val_change=True)