Skip to content

Commit 25e1aff

Browse files
dconathancarmocca
andauthored
Allow MLFlowLogger to work with mlflow-skinny (#16513)
Co-authored-by: Carlos Mocholí <[email protected]> Fixes #16486
1 parent c854e4d commit 25e1aff

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/pytorch_lightning/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1515

1616
- Added an argument `include_cuda` in `pytorch_lightning.utilities.seed.isolate_rng` to disable managing `torch.cuda`'s rng ([#16423](https://github.com/Lightning-AI/lightning/pull/16423))
1717

18+
- Added support for running the `MLFlowLogger` with the `mlflow-skinny` package ([16513](https://github.com/Lightning-AI/lightning/pull/16513))
19+
1820
- Added a `Trainer.received_sigterm` property to check whether a SIGTERM signal was received ([#16501](https://github.com/Lightning-AI/lightning/pull/16501))
1921

2022
### Changed
@@ -153,7 +155,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
153155
- Fixed strict availability check for `torch_xla` requirement ([#16476](https://github.com/Lightning-AI/lightning/pull/16476))
154156

155157

156-
157158
## [1.9.0] - 2023-01-17
158159

159160
### Added

src/pytorch_lightning/loggers/mlflow.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737

3838
log = logging.getLogger(__name__)
3939
LOCAL_FILE_URI_PREFIX = "file:"
40-
_MLFLOW_AVAILABLE = RequirementCache("mlflow>=1.0.0")
40+
_MLFLOW_FULL_AVAILABLE = RequirementCache("mlflow>=1.0.0")
41+
_MLFLOW_SKINNY_AVAILABLE = RequirementCache("mlflow-skinny>=1.0.0")
42+
_MLFLOW_AVAILABLE = _MLFLOW_FULL_AVAILABLE or _MLFLOW_SKINNY_AVAILABLE
4143
if _MLFLOW_AVAILABLE:
4244
from mlflow.entities import Metric, Param
4345
from mlflow.tracking import context, MlflowClient
@@ -78,7 +80,7 @@ class MLFlowLogger(Logger):
7880
7981
.. code-block:: bash
8082
81-
pip install mlflow
83+
pip install mlflow # or mlflow-skinny
8284
8385
.. code-block:: python
8486
@@ -148,7 +150,9 @@ def __init__(
148150
run_id: Optional[str] = None,
149151
):
150152
if not _MLFLOW_AVAILABLE:
151-
raise ModuleNotFoundError(str(_MLFLOW_AVAILABLE))
153+
raise ModuleNotFoundError(
154+
f"{_MLFLOW_FULL_AVAILABLE!s}. You can also try {_MLFLOW_SKINNY_AVAILABLE.requirement!r}"
155+
)
152156
super().__init__()
153157
if not tracking_uri:
154158
tracking_uri = f"{LOCAL_FILE_URI_PREFIX}{save_dir}"

0 commit comments

Comments
 (0)