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

Commit 7bbfd79

Browse files
committed
final fix
1 parent 8481ddc commit 7bbfd79

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/sparseml/pytorch/utils/logger.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
except Exception as err:
4545
wandb = None
4646
wandb_err = err
47-
raise ModuleNotFoundError(
48-
"Error: Failed to import wandb. "
49-
"Please install the wandb library in order to use it."
50-
) from wandb_err
5147

5248
from sparseml.utils import ALL_TOKEN, create_dirs
5349

@@ -538,7 +534,14 @@ def __init__(
538534
init_kwargs: Optional[Dict] = None,
539535
name: str = "wandb",
540536
enabled: bool = True,
537+
wandb_err: Optional[Exception] = wandb_err,
541538
):
539+
if wandb_err:
540+
raise ModuleNotFoundError(
541+
"Error: Failed to import wandb. "
542+
"Please install the wandb library in order to use it."
543+
) from wandb_err
544+
542545
super().__init__(
543546
lambda_func=self._log_lambda,
544547
name=name,

0 commit comments

Comments
 (0)