Rüdiger Busche commited on
Commit
602d7ff
·
unverified ·
1 Parent(s): 92e47b8

Check TensorBoard logger before adding graph (#8664)

Browse files

Otherwise, an error is thrown if the tensorboard logger is not included.

Files changed (1) hide show
  1. utils/loggers/__init__.py +1 -1
utils/loggers/__init__.py CHANGED
@@ -102,7 +102,7 @@ class Loggers():
102
  # Callback runs on train batch end
103
  if plots:
104
  if ni == 0:
105
- if not self.opt.sync_bn: # --sync known issue https://github.com/ultralytics/yolov5/issues/3754
106
  with warnings.catch_warnings():
107
  warnings.simplefilter('ignore') # suppress jit trace warning
108
  self.tb.add_graph(torch.jit.trace(de_parallel(model), imgs[0:1], strict=False), [])
 
102
  # Callback runs on train batch end
103
  if plots:
104
  if ni == 0:
105
+ if self.tb and not self.opt.sync_bn: # --sync known issue https://github.com/ultralytics/yolov5/issues/3754
106
  with warnings.catch_warnings():
107
  warnings.simplefilter('ignore') # suppress jit trace warning
108
  self.tb.add_graph(torch.jit.trace(de_parallel(model), imgs[0:1], strict=False), [])