Image Overview: mlflow

Overview: mlflow Chainguard Image

A minimal, Wolfi-based image for MLflow, an open source platform for the machine learning lifecycle.

Download this Image

The image is available on

docker pull

MLflow Usage

MLflow’s default entrypoint is Python, enabling us to run experiments directly:

docker run -it <your experiment>.py

Otherwise, we can override the entrypoint and interact with MLflow:

docker run -it --entrypoint mlflow <options>

MLflow Tracking Usage

MLflow provides a UI, MLflow Tracking, that allows the user to track ‘runs’ (the execution of data science code) via visualizations of metrics, parameters, and artifacts.

To start the UI, open a terminal and run:

docker run -it -p 5000:5000 --entrypoint mlflow ui

While the UI defaults to running on port 5000, you can use a different port via passing -p <PORT> as a command line option. Ensure Docker also maps to the correct port.

You should now be able to access the UI at localhost:5000.

The Tracking API can now be leveraged to record metrics, parameters, and artifacts:

import mlflow

# Set the MLflow tracking URI

# Start an experiment

with mlflow.start_run():
    # Log parameters, metrics, and artifacts
    mlflow.log_param("param1", value1)
    mlflow.log_metric("metric1", value2)
    # Train and log model
    mlflow.sklearn.log_model(model, "model")

Ensure that the tracking URI correctly reflects where the MLflow server is running.

For additional documentation covering MLflow Tracking, see the official docs.

Last updated: 2024-05-10 00:43