From 662d61bd7be207e446ad01b9fed4229d1c7ad7b9 Mon Sep 17 00:00:00 2001 From: Damian Date: Thu, 9 Feb 2023 14:01:06 +0000 Subject: [PATCH 1/3] clean cherry pick --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 1a306bc89f1..7126e005a20 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,7 @@ "GPUtil>=1.4.0", "protobuf>=3.12.2,<=3.20.1", "click~=8.0.0", + "wandb>=v0.13.10", ] _nm_deps = [f"{'sparsezoo' if is_release else 'sparsezoo-nightly'}~={version_nm_deps}"] _deepsparse_deps = [ From 8481ddce9efa97579b15fcb53271f52d0cb9c1b1 Mon Sep 17 00:00:00 2001 From: Damian Date: Fri, 10 Feb 2023 18:20:19 +0000 Subject: [PATCH 2/3] new solution --- setup.py | 1 - src/sparseml/pytorch/utils/logger.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7126e005a20..1a306bc89f1 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,6 @@ "GPUtil>=1.4.0", "protobuf>=3.12.2,<=3.20.1", "click~=8.0.0", - "wandb>=v0.13.10", ] _nm_deps = [f"{'sparsezoo' if is_release else 'sparsezoo-nightly'}~={version_nm_deps}"] _deepsparse_deps = [ diff --git a/src/sparseml/pytorch/utils/logger.py b/src/sparseml/pytorch/utils/logger.py index 9d7cc4e3c2d..57bb7bc6a91 100644 --- a/src/sparseml/pytorch/utils/logger.py +++ b/src/sparseml/pytorch/utils/logger.py @@ -44,6 +44,10 @@ except Exception as err: wandb = None wandb_err = err + raise ModuleNotFoundError( + "Error: Failed to import wandb. " + "Please install the wandb library in order to use it." + ) from wandb_err from sparseml.utils import ALL_TOKEN, create_dirs From 7bbfd79c1cc3add6c6007f1981c75ffbf0930cd5 Mon Sep 17 00:00:00 2001 From: Damian Date: Mon, 13 Feb 2023 12:59:25 +0000 Subject: [PATCH 3/3] final fix --- src/sparseml/pytorch/utils/logger.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sparseml/pytorch/utils/logger.py b/src/sparseml/pytorch/utils/logger.py index 57bb7bc6a91..66ea8e920ac 100644 --- a/src/sparseml/pytorch/utils/logger.py +++ b/src/sparseml/pytorch/utils/logger.py @@ -44,10 +44,6 @@ except Exception as err: wandb = None wandb_err = err - raise ModuleNotFoundError( - "Error: Failed to import wandb. " - "Please install the wandb library in order to use it." - ) from wandb_err from sparseml.utils import ALL_TOKEN, create_dirs @@ -538,7 +534,14 @@ def __init__( init_kwargs: Optional[Dict] = None, name: str = "wandb", enabled: bool = True, + wandb_err: Optional[Exception] = wandb_err, ): + if wandb_err: + raise ModuleNotFoundError( + "Error: Failed to import wandb. " + "Please install the wandb library in order to use it." + ) from wandb_err + super().__init__( lambda_func=self._log_lambda, name=name,