W&B: More improvements and refactoring (#4205)
Browse files* 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 <[email protected]>
utils/loggers/__init__.py
CHANGED
@@ -48,12 +48,12 @@ class Loggers():
|
|
48 |
self.tb = SummaryWriter(str(s))
|
49 |
|
50 |
# W&B
|
51 |
-
|
52 |
-
|
53 |
-
run_id = torch.load(self.weights).get('wandb_id') if self.opt.resume else None
|
54 |
self.opt.hyp = self.hyp # add hyperparameters
|
55 |
self.wandb = WandbLogger(self.opt, run_id)
|
56 |
-
|
57 |
self.wandb = None
|
58 |
|
59 |
return self
|
|
|
48 |
self.tb = SummaryWriter(str(s))
|
49 |
|
50 |
# W&B
|
51 |
+
if wandb and 'wandb' in self.include:
|
52 |
+
wandb_artifact_resume = isinstance(self.opt.resume, str) and self.opt.resume.startswith('wandb-artifact://')
|
53 |
+
run_id = torch.load(self.weights).get('wandb_id') if self.opt.resume and not wandb_artifact_resume else None
|
54 |
self.opt.hyp = self.hyp # add hyperparameters
|
55 |
self.wandb = WandbLogger(self.opt, run_id)
|
56 |
+
else:
|
57 |
self.wandb = None
|
58 |
|
59 |
return self
|
utils/loggers/wandb/wandb_utils.py
CHANGED
@@ -158,11 +158,12 @@ class WandbLogger():
|
|
158 |
self.data_dict = check_dataset(opt.data)
|
159 |
|
160 |
self.setup_training(opt)
|
161 |
-
# write data_dict to config. useful for resuming from artifacts
|
162 |
if not self.wandb_artifact_data_dict:
|
163 |
self.wandb_artifact_data_dict = self.data_dict
|
164 |
-
|
165 |
-
|
|
|
|
|
166 |
|
167 |
if self.job_type == 'Dataset Creation':
|
168 |
self.data_dict = self.check_and_upload_dataset(opt)
|
|
|
158 |
self.data_dict = check_dataset(opt.data)
|
159 |
|
160 |
self.setup_training(opt)
|
|
|
161 |
if not self.wandb_artifact_data_dict:
|
162 |
self.wandb_artifact_data_dict = self.data_dict
|
163 |
+
# write data_dict to config. useful for resuming from artifacts. Do this only when not resuming.
|
164 |
+
if not opt.resume:
|
165 |
+
self.wandb_run.config.update({'data_dict': self.wandb_artifact_data_dict},
|
166 |
+
allow_val_change=True)
|
167 |
|
168 |
if self.job_type == 'Dataset Creation':
|
169 |
self.data_dict = self.check_and_upload_dataset(opt)
|