Skip to content

Commit

Permalink
tey
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Jun 30, 2023
1 parent 676aa88 commit 031fad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/pl_bolts/callbacks/sparseml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@
from typing import Any, Optional

import torch
from lightning_utilities.core.rank_zero import rank_zero_warn
from pytorch_lightning import Callback, LightningModule, Trainer
from pytorch_lightning.utilities.exceptions import MisconfigurationException

from pl_bolts.utils import _SPARSEML_AVAILABLE

if _SPARSEML_AVAILABLE:
try:
import sparseml
except ImportError as err:
_SPARSEML_AVAILABLE = False
rank_zero_warn(str(err))

if _SPARSEML_AVAILABLE:
from sparseml.pytorch.optim import ScheduledModifierManager
from sparseml.pytorch.utils import ModuleExporter
Expand Down
5 changes: 5 additions & 0 deletions src/pl_bolts/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@
_MATPLOTLIB_AVAILABLE: bool = module_available("matplotlib")
_JSONARGPARSE_GREATER_THAN_4_16_0 = compare_version("jsonargparse", operator.gt, "4.16.0")

if _SPARSEML_AVAILABLE:
import sparseml

_SPARSEML_AVAILABLE = compare_version("sparseml", operator.le, sparseml.pytorch.base._TORCH_MAX_VERSION)


__all__ = ["BatchGradientVerification"]

0 comments on commit 031fad5

Please sign in to comment.