W&B: Restructure code to support the new dataset_check() feature (#4197)

* 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

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Ayush ChaurasiaandGlenn Jocher authored and GitHub committed 2021-07-28 17:40:08 +02:00
1 parent 2683b18079
commit e88e8f7a98
6 files changed
+52 -40

No files matched your search

+4 -9
View File
@@ -1,9 +1,7 @@
# YOLOv5 experiment logging utils
import torch
import warnings
from threading import Thread
import torch
from torch.utils.tensorboard import SummaryWriter
from utils.general import colorstr, emojis
@@ -23,12 +21,11 @@ except (ImportError, AssertionError):
class Loggers():
# YOLOv5 Loggers class
def __init__(self, save_dir=None, weights=None, opt=None, hyp=None, data_dict=None, logger=None, include=LOGGERS):
def __init__(self, save_dir=None, weights=None, opt=None, hyp=None, logger=None, include=LOGGERS):
self.save_dir = save_dir
self.weights = weights
self.opt = opt
self.hyp = hyp
self.data_dict = data_dict
self.logger = logger # for printing results to console
self.include = include
for k in LOGGERS:
@@ -38,9 +35,7 @@ class Loggers():
self.csv = True # always log to csv
# Message
try:
import wandb
except ImportError:
if not wandb:
prefix = colorstr('Weights & Biases: ')
s = f"{prefix}run 'pip install wandb' to automatically track and visualize YOLOv5 🚀 runs (RECOMMENDED)"
print(emojis(s))
@@ -57,7 +52,7 @@ class Loggers():
assert 'wandb' in self.include and wandb
run_id = torch.load(self.weights).get('wandb_id') if self.opt.resume else None
self.opt.hyp = self.hyp # add hyperparameters
self.wandb = WandbLogger(self.opt, run_id, self.data_dict)
self.wandb = WandbLogger(self.opt, run_id)
except:
self.wandb = None