Skip to main content

MLflow community flavor and autologging for AutoGluon predictors

Project description

mlflow-autogluon

CI Docs License Python

MLflow community model flavor and autologging for AutoGluon predictors.

Documentation: phylatech.github.io/mlflow-autogluon

AutoGluon has no built-in MLflow flavor, and the MLflow maintainers have asked for this integration to live as a community flavor (see mlflow/mlflow#13214 and autogluon/autogluon#1404). This package provides that integration:

  • Model flavor: save_model, log_model, and load_model for TabularPredictor, TimeSeriesPredictor, and MultiModalPredictor, with full round-trip fidelity.
  • PyFunc support: logged models load with mlflow.pyfunc.load_model and serve with mlflow models serve, including predict_proba via inference params and long-format DataFrame forecasting for timeseries models.
  • Autologging: one call to mlflow_autogluon.autolog() records params, leaderboard metrics, artifacts, and the fitted predictor for every fit call, across all installed predictor types.

Installation

pip install mlflow-autogluon[tabular]

Autologging quickstart

import mlflow_autogluon
from autogluon.tabular import TabularPredictor

mlflow_autogluon.autolog()

predictor = TabularPredictor(label="target").fit(train_data, presets="medium_quality")

That single autolog() call gives you, per fit:

What Examples
Params label, problem_type, eval_metric, presets, time_limit, hyperparameters, train_rows
Metrics best_model_score_val, fit_time_seconds, per-model score_val_* / fit_time_*
Tags estimator_name, autogluon_version, best_model, problem_type
Artifacts leaderboard.csv, optional fit_summary.json, the fitted model

Because this is a community flavor, mlflow.autolog() does not enable it automatically; call mlflow_autogluon.autolog() explicitly. Options:

mlflow_autogluon.autolog(
    log_models=True,             # log the fitted predictor as an MLflow model
    log_leaderboard=True,        # leaderboard CSV artifact + per-model metrics
    log_fit_summary=False,       # fit_summary() as a JSON artifact
    registered_model_name=None,  # also register logged models under this name
    extra_tags=None,             # extra tags applied to autologged runs
    disable=False,               # turn the integration off
)

Manual logging

import mlflow
import mlflow_autogluon

with mlflow.start_run():
    model_info = mlflow_autogluon.log_model(
        ag_model=predictor,
        artifact_path="model",
        input_example=train_data.drop(columns=["target"]).head(),
    )

# Load back the native predictor
predictor = mlflow_autogluon.load_model(model_info.model_uri)

# Or load as a generic pyfunc for serving
pyfunc_model = mlflow.pyfunc.load_model(model_info.model_uri)
predictions = pyfunc_model.predict(test_data)
probabilities = pyfunc_model.predict(test_data, params={"predict_method": "predict_proba"})

Serving works out of the box:

mlflow models serve -m "models:/<name>/<version>" -p 5001

Compatibility

  • Python >= 3.9 (CI: 3.10, 3.11, 3.12)
  • MLflow >= 2.15 (CI: latest 3.x and the 2.x line)
  • AutoGluon >= 1.1: TabularPredictor ([tabular] extra), TimeSeriesPredictor ([timeseries]), and MultiModalPredictor ([multimodal])

See examples/autolog_quickstart.py for a complete runnable walkthrough on a real dataset.

Roadmap

  • Model signature inference during autologging
  • ClearML integration (tracked separately)

Development

The repo ships an environment.yml for a conda/mamba based dev environment:

mamba env create -f environment.yml
mamba run -n mlflow-autogluon pip install -e .
mamba run -n mlflow-autogluon pytest

License

Apache License 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlflow_autogluon-0.1.0.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlflow_autogluon-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file mlflow_autogluon-0.1.0.tar.gz.

File metadata

  • Download URL: mlflow_autogluon-0.1.0.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mlflow_autogluon-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad1dd772ff8119fe27101cec3ce5606f884f6b2c7c9c1b20bdd34fd9afcfa4f6
MD5 a44093d16d5422acd63c77c2fe896d75
BLAKE2b-256 6524ba6316a9ab103c216edfdca65f4f87a386a5aa80393969e4ffeeaaa440d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlflow_autogluon-0.1.0.tar.gz:

Publisher: publish-pypi.yml on PhylaTech/mlflow-autogluon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mlflow_autogluon-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mlflow_autogluon-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eb7b040ee2202da78295ef2c39a0be81d8419e2e0fba5a1960b80884fb23ae1
MD5 cbe148a278a710d1189dfb5ceb8a1e33
BLAKE2b-256 9557133c62adaa3aad52ef7b187d3eec71593d90e71ad322e2398fdb51ea79cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlflow_autogluon-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on PhylaTech/mlflow-autogluon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page