Skip to main content

MLflow is an open source platform for the complete machine learning lifecycle

Project description

📣 This is the mlflow-skinny package, a lightweight MLflow package without SQL storage, server, UI, or data science dependencies. Additional dependencies can be installed to leverage the full feature set of MLflow. For example:

  • To use the mlflow.sklearn component of MLflow Models, install scikit-learn, numpy and pandas.
  • To use SQL-based metadata storage, install sqlalchemy, alembic, and sqlparse.
  • To use serving-based features, install flask and pandas.



MLflow logo

Open-Source Platform for Productionizing AI

MLflow is an open-source developer platform to build AI/LLM applications and models with confidence. Enhance your AI applications with end-to-end experiment tracking, observability, and evaluations, all in one integrated platform.


🚀 Installation

To install the MLflow Python package, run the following command:

pip install mlflow

📦 Core Components

MLflow is the only platform that provides a unified solution for all your AI/ML needs, including LLMs, Agents, Deep Learning, and traditional machine learning.

💡 For LLM / GenAI Developers

Tracing

🔍 Tracing / Observability

Trace the internal states of your LLM/agentic applications for debugging quality issues and monitoring performance with ease.

Getting Started →

LLM Evaluation

📊 LLM Evaluation

A suite of automated model evaluation tools, seamlessly integrated with experiment tracking to compare across multiple versions.

Getting Started →

Prompt Management

🤖 Prompt Management

Version, track, and reuse prompts across your organization, helping maintain consistency and improve collaboration in prompt development.

Getting Started →

MLflow Hero

📦 App Version Tracking

MLflow keeps track of many moving parts in your AI applications, such as models, prompts, tools, and code, with end-to-end lineage.

Getting Started →

🎓 For Data Scientists

Tracking

📝 Experiment Tracking

Track your models, parameters, metrics, and evaluation results in ML experiments and compare them using an interactive UI.

Getting Started →

Model Registry

💾 Model Registry

A centralized model store designed to collaboratively manage the full lifecycle and deployment of machine learning models.

Getting Started →

Deployment

🚀 Deployment

Tools for seamless model deployment to batch and real-time scoring on platforms like Docker, Kubernetes, Azure ML, and AWS SageMaker.

Getting Started →

🌐 Hosting MLflow Anywhere

Providers

You can run MLflow in many different environments, including local machines, on-premise servers, and cloud infrastructure.

Trusted by thousands of organizations, MLflow is now offered as a managed service by most major cloud providers:

For hosting MLflow on your own infrastructure, please refer to this guidance.

🗣️ Supported Programming Languages

🔗 Integrations

MLflow is natively integrated with many popular machine learning frameworks and GenAI libraries.

Integrations

Usage Examples

Tracing (Observability) (Doc)

MLflow Tracing provides LLM observability for various GenAI libraries such as OpenAI, LangChain, LlamaIndex, DSPy, AutoGen, and more. To enable auto-tracing, call mlflow.xyz.autolog() before running your models. Refer to the documentation for customization and manual instrumentation.

import mlflow
from openai import OpenAI

# Enable tracing for OpenAI
mlflow.openai.autolog()

# Query OpenAI LLM normally
response = OpenAI().chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hi!"}],
    temperature=0.1,
)

Then navigate to the "Traces" tab in the MLflow UI to find the trace records for the OpenAI query.

Evaluating LLMs, Prompts, and Agents (Doc)

The following example runs automatic evaluation for question-answering tasks with several built-in metrics.

import os
import openai
import mlflow
from mlflow.genai.scorers import Correctness, Guidelines

client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

# 1. Define a simple QA dataset
dataset = [
    {
        "inputs": {"question": "Can MLflow manage prompts?"},
        "expectations": {"expected_response": "Yes!"},
    },
    {
        "inputs": {"question": "Can MLflow create a taco for my lunch?"},
        "expectations": {
            "expected_response": "No, unfortunately, MLflow is not a taco maker."
        },
    },
]


# 2. Define a prediction function to generate responses
def predict_fn(question: str) -> str:
    response = client.chat.completions.create(
        model="gpt-4o-mini", messages=[{"role": "user", "content": question}]
    )
    return response.choices[0].message.content


# 3. Run the evaluation
results = mlflow.genai.evaluate(
    data=dataset,
    predict_fn=predict_fn,
    scorers=[
        # Built-in LLM judge
        Correctness(),
        # Custom criteria using LLM judge
        Guidelines(name="is_english", guidelines="The answer must be in English"),
    ],
)

Navigate to the "Evaluations" tab in the MLflow UI to find the evaluation results.

Tracking Model Training (Doc)

The following example trains a simple regression model with scikit-learn, while enabling MLflow's autologging feature for experiment tracking.

import mlflow

from sklearn.model_selection import train_test_split
from sklearn.datasets import load_diabetes
from sklearn.ensemble import RandomForestRegressor

# Enable MLflow's automatic experiment tracking for scikit-learn
mlflow.sklearn.autolog()

# Load the training dataset
db = load_diabetes()
X_train, X_test, y_train, y_test = train_test_split(db.data, db.target)

rf = RandomForestRegressor(n_estimators=100, max_depth=6, max_features=3)
# MLflow triggers logging automatically upon model fitting
rf.fit(X_train, y_train)

Once the above code finishes, run the following command in a separate terminal and access the MLflow UI via the printed URL. An MLflow Run should be automatically created, which tracks the training dataset, hyperparameters, performance metrics, the trained model, dependencies, and even more.

mlflow server

💭 Support

  • For help or questions about MLflow usage (e.g. "how do I do X?") visit the documentation.
  • In the documentation, you can ask the question to our AI-powered chat bot. Click on the "Ask AI" button at the right bottom.
  • Join the virtual events like office hours and meetups.
  • To report a bug, file a documentation issue, or submit a feature request, please open a GitHub issue.
  • For release announcements and other discussions, please subscribe to our mailing list (mlflow-users@googlegroups.com) or join us on Slack.

🤝 Contributing

We happily welcome contributions to MLflow!

Please see our contribution guide to learn more about contributing to MLflow.

⭐️ Star History

Star History Chart

✏️ Citation

If you use MLflow in your research, please cite it using the "Cite this repository" button at the top of the GitHub repository page, which will provide you with citation formats including APA and BibTeX.

👥 Core Members

MLflow is currently maintained by the following core members with significant contributions from hundreds of exceptionally talented community members.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

mlflow_skinny-3.10.1.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

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

mlflow_skinny-3.10.1-py3-none-any.whl (3.0 MB view details)

Uploaded Python 3

File details

Details for the file mlflow_skinny-3.10.1.tar.gz.

File metadata

  • Download URL: mlflow_skinny-3.10.1.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for mlflow_skinny-3.10.1.tar.gz
Algorithm Hash digest
SHA256 3d1c5c30245b6e7065b492b09dd47be7528e0a14c4266b782fe58f9bcd1e0be0
MD5 d5ec703cc660ea601be1079d799db862
BLAKE2b-256 71655b2c28e74c167ba8a5afe59399ef44291a0f140487f534db1900f09f59f6

See more details on using hashes here.

File details

Details for the file mlflow_skinny-3.10.1-py3-none-any.whl.

File metadata

  • Download URL: mlflow_skinny-3.10.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for mlflow_skinny-3.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df1dd507d8ddadf53bfab2423c76cdcafc235cd1a46921a06d1a6b4dd04b023c
MD5 d26e1dde5140c99e48af75cebbc059d1
BLAKE2b-256 4b5217460157271e70b0d8444d27f8ad730ef7d95fb82fac59dc19f11519b921

See more details on using hashes here.

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