Commit
•
d0bfeb3
1
Parent(s):
a346926
W&B: fix DDP with wandb disabled (#5163)
Browse files* fix dpp with wandb disabled
* PyCharm reformat
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
utils/loggers/__init__.py
CHANGED
@@ -3,9 +3,11 @@
|
|
3 |
Logging utils
|
4 |
"""
|
5 |
|
|
|
6 |
import warnings
|
7 |
from threading import Thread
|
8 |
|
|
|
9 |
import torch
|
10 |
from torch.utils.tensorboard import SummaryWriter
|
11 |
|
@@ -15,11 +17,16 @@ from utils.plots import plot_images, plot_results
|
|
15 |
from utils.torch_utils import de_parallel
|
16 |
|
17 |
LOGGERS = ('csv', 'tb', 'wandb') # text-file, TensorBoard, Weights & Biases
|
|
|
18 |
|
19 |
try:
|
20 |
import wandb
|
21 |
|
22 |
assert hasattr(wandb, '__version__') # verify package import not local dir
|
|
|
|
|
|
|
|
|
23 |
except (ImportError, AssertionError):
|
24 |
wandb = None
|
25 |
|
|
|
3 |
Logging utils
|
4 |
"""
|
5 |
|
6 |
+
import os
|
7 |
import warnings
|
8 |
from threading import Thread
|
9 |
|
10 |
+
import pkg_resources as pkg
|
11 |
import torch
|
12 |
from torch.utils.tensorboard import SummaryWriter
|
13 |
|
|
|
17 |
from utils.torch_utils import de_parallel
|
18 |
|
19 |
LOGGERS = ('csv', 'tb', 'wandb') # text-file, TensorBoard, Weights & Biases
|
20 |
+
RANK = int(os.getenv('RANK', -1))
|
21 |
|
22 |
try:
|
23 |
import wandb
|
24 |
|
25 |
assert hasattr(wandb, '__version__') # verify package import not local dir
|
26 |
+
if pkg.parse_version(wandb.__version__) >= pkg.parse_version('0.12.2') and RANK in [0, -1]:
|
27 |
+
wandb_login_success = wandb.login(timeout=30)
|
28 |
+
if not wandb_login_success:
|
29 |
+
wandb = None
|
30 |
except (ImportError, AssertionError):
|
31 |
wandb = None
|
32 |
|
utils/loggers/wandb/wandb_utils.py
CHANGED
@@ -20,16 +20,6 @@ from utils.datasets import img2label_paths
|
|
20 |
from utils.general import check_dataset, check_file
|
21 |
|
22 |
RANK = int(os.getenv('RANK', -1))
|
23 |
-
|
24 |
-
try:
|
25 |
-
import wandb
|
26 |
-
|
27 |
-
assert hasattr(wandb, '__version__') # verify package import not local dir
|
28 |
-
if pkg.parse_version(wandb.__version__) >= pkg.parse_version('0.12.2') and RANK in [0, -1]:
|
29 |
-
wandb.login(timeout=30)
|
30 |
-
except (ImportError, AssertionError):
|
31 |
-
wandb = None
|
32 |
-
|
33 |
WANDB_ARTIFACT_PREFIX = 'wandb-artifact://'
|
34 |
|
35 |
|
|
|
20 |
from utils.general import check_dataset, check_file
|
21 |
|
22 |
RANK = int(os.getenv('RANK', -1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
WANDB_ARTIFACT_PREFIX = 'wandb-artifact://'
|
24 |
|
25 |
|