Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 84deda6

Browse files
authored
[torchvision IC] catch import error for instantiation of optional tensorboard logger (#1457)
1 parent d1d4051 commit 84deda6

File tree

1 file changed

+4
-1
lines changed
  • src/sparseml/pytorch/torchvision

1 file changed

+4
-1
lines changed

src/sparseml/pytorch/torchvision/train.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,11 @@ def collate_fn(batch):
573573
if utils.is_main_process():
574574
loggers = [
575575
PythonLogger(logger=_LOGGER),
576-
TensorBoardLogger(log_path=args.output_dir),
577576
]
577+
try:
578+
loggers.append(TensorBoardLogger(log_path=args.output_dir))
579+
except (ModuleNotFoundError, ImportError):
580+
warnings.warn("Unable to import tensorboard for logging")
578581
try:
579582
config = vars(args)
580583
if manager is not None:

0 commit comments

Comments
 (0)