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

Commit 5ffa7d7

Browse files
rahul-tulibfineran
authored andcommitted
torch setuptools bugfix (#593)
* Remove: Ignore tensorboard logger if attribute error due to torch and setuptools * Remove: Ignore tensorboard logger if attribute error due to torch and setuptools * Use warning instead of printing Style Fixes
1 parent b4e0e08 commit 5ffa7d7

File tree

1 file changed

+9
-1
lines changed
  • src/sparseml/pytorch/image_classification/utils

1 file changed

+9
-1
lines changed

src/sparseml/pytorch/image_classification/utils/helpers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Helper methods for image classification/detection based tasks
1717
"""
1818
import os
19+
import warnings
1920
from enum import Enum, auto, unique
2021
from typing import Any, List, Optional, Tuple, Union
2122

@@ -99,7 +100,14 @@ def get_save_dir_and_loggers(
99100
if task == Tasks.TRAIN:
100101
logs_dir = os.path.join(logs_dir, model_id)
101102
create_dirs(logs_dir)
102-
loggers.append(TensorBoardLogger(log_path=logs_dir))
103+
try:
104+
loggers.append(TensorBoardLogger(log_path=logs_dir))
105+
except AttributeError:
106+
warnings.warn(
107+
"Failed to initialize TensorBoard logger, "
108+
"it will not be used for logging",
109+
)
110+
103111
print(f"Model id is set to {model_id}")
104112
else:
105113
# do not log for non main processes

0 commit comments

Comments
 (0)