Skip to content

Commit

Permalink
Fallback to module available check for mlflow (#17467)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca authored Apr 25, 2023
1 parent b792c90 commit b0af0ee
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lightning/pytorch/loggers/mlflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@

log = logging.getLogger(__name__)
LOCAL_FILE_URI_PREFIX = "file:"
_MLFLOW_FULL_AVAILABLE = RequirementCache("mlflow>=1.0.0")
_MLFLOW_SKINNY_AVAILABLE = RequirementCache("mlflow-skinny>=1.0.0")
_MLFLOW_AVAILABLE = _MLFLOW_FULL_AVAILABLE or _MLFLOW_SKINNY_AVAILABLE
_MLFLOW_AVAILABLE = RequirementCache("mlflow>=1.0.0", "mlflow")
if _MLFLOW_AVAILABLE:
from mlflow.entities import Metric, Param
from mlflow.tracking import context, MlflowClient
Expand Down Expand Up @@ -149,9 +147,7 @@ def __init__(
run_id: Optional[str] = None,
):
if not _MLFLOW_AVAILABLE:
raise ModuleNotFoundError(
f"{_MLFLOW_FULL_AVAILABLE!s}. You can also try {_MLFLOW_SKINNY_AVAILABLE.requirement!r}"
)
raise ModuleNotFoundError(str(_MLFLOW_AVAILABLE))
super().__init__()
if not tracking_uri:
tracking_uri = f"{LOCAL_FILE_URI_PREFIX}{save_dir}"
Expand Down

0 comments on commit b0af0ee

Please sign in to comment.