Skip to content

An improved Lightning mlflow logger to replace mlflow.autolog()

License

Notifications You must be signed in to change notification settings

twsl/lit-mlflow

Repository files navigation

lit-mlflow

Build Documentation GitHub Release PyPI - Package Version PyPI - Python Version Dependencies Status Docs with MkDocs Poetry linting: ruff pre-commit Checked with pyright security: bandit Semantic Versions Copier License

An improved Lightning mlflow logger. Works seamlessly with PyTorch Lightning on Databricks and offers more control compared to the mlflow.pytorch.autolog function.

Features

  • Makes MLflow logging work with lightning and Databricks

Installation

With pip:

python -m pip install lit-mlflow

With poetry:

poetry add lit-mlflow

How to use it

Replace mlflow.autolog() with the MlFlowAutoCallback:

from lit_mlflow import MlFlowAutoCallback
import lightning.pytorch as pl

trainer = pl.Trainer(
    callbacks=[
        MlFlowAutoCallback()
    ]
)

To support Databricks mlflow, use the DbxMLFlowLogger instead of the MlFlowLogger:

from lit_mlflow import DbxMLFlowLogger
import lightning.pytorch as pl

trainer = pl.Trainer(
    logger=[
        DbxMLFlowLogger()
    ]
)

Docs

poetry run mkdocs build -f ./docs/mkdocs.yml -d ./_build/

Update template

copier update --trust -A --vcs-ref=HEAD

Credits

This project was generated with 🚀 A generic python project template.