or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

client.mdconfiguration.mddata.mdframeworks.mdgenai.mdindex.mdmodels.mdprojects.mdtracing.mdtracking.md
tile.json

tessl/pypi-mlflow

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

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/mlflow@3.3.x

To install, run

npx @tessl/cli install tessl/pypi-mlflow@3.3.0

index.mddocs/

MLflow

MLflow is an open-source developer platform designed to build AI/LLM applications and models with confidence. It provides a comprehensive solution for managing the complete machine learning lifecycle, including experiment tracking, model management, deployment, and observability. The platform offers specialized features for both LLM/GenAI developers (tracing/observability, LLM evaluation, prompt management, version tracking) and traditional data scientists (experiment tracking, model registry, deployment tools).

Package Information

  • Package Name: mlflow
  • Language: Python
  • Installation: pip install mlflow
  • Documentation: https://mlflow.org/docs/latest/index.html

Core Imports

import mlflow

For client API access:

from mlflow import MlflowClient
client = MlflowClient()

For specific modules:

import mlflow.tracking
import mlflow.models
import mlflow.data
import mlflow.tracing

Basic Usage

import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
import numpy as np

# Set tracking URI and experiment
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("my-experiment")

# Generate sample data
X = np.random.rand(100, 4)
y = np.random.rand(100)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Start MLflow run with context manager
with mlflow.start_run():
    # Enable autologging for sklearn
    mlflow.sklearn.autolog()
    
    # Train model
    model = RandomForestRegressor(n_estimators=50, random_state=42)
    model.fit(X_train, y_train)
    
    # Log custom parameters and metrics
    mlflow.log_param("custom_param", "value")
    mlflow.log_metric("custom_metric", 0.85)
    
    # Log model manually (optional with autolog)
    mlflow.sklearn.log_model(model, "model")
    
    # Get run info
    run = mlflow.active_run()
    print(f"Run ID: {run.info.run_id}")

Architecture

MLflow's modular architecture supports the complete ML lifecycle:

  • Tracking: Experiment and run management with parameter, metric, and artifact logging
  • Models: Universal model format with deployment capabilities across platforms
  • Model Registry: Centralized model store with versioning and stage transitions
  • Projects: Reproducible ML code packaging with dependency management
  • Tracing: Distributed tracing for LLM/GenAI applications with observability
  • Data: Dataset tracking and lineage with multiple format support
  • Evaluation: Model performance assessment with built-in metrics and custom evaluators

The platform integrates natively with 25+ ML frameworks and 15+ LLM/GenAI libraries, providing automatic logging capabilities and standardized model formats for seamless deployment across infrastructures.

Capabilities

Tracking and Experiment Management

Core functionality for tracking experiments, runs, parameters, metrics, and artifacts. Provides both fluent API for interactive use and client API for programmatic access.

def start_run(run_id=None, experiment_id=None, run_name=None, nested=False, tags=None, description=None): ...
def end_run(status=None): ...
def log_param(key, value): ...
def log_metric(key, value, step=None, timestamp=None, synchronous=None): ...
def log_artifact(local_path, artifact_path=None, synchronous=None): ...
def log_outputs(outputs, artifact_path=None): ...
def log_assessment(assessment, request_id=None, run_id=None, timestamp_ms=None): ...
def log_feedback(feedback, request_id=None, run_id=None): ...
def create_experiment(name, artifact_location=None, tags=None): ...
def set_experiment(experiment_name=None, experiment_id=None): ...

Tracking and Experiments

Client API

Lower-level programmatic interface providing direct access to MLflow's REST API with comprehensive methods for managing experiments, runs, models, and artifacts.

class MlflowClient:
    def __init__(self, tracking_uri=None, registry_uri=None): ...
    def create_experiment(self, name, artifact_location=None, tags=None): ...
    def get_run(self, run_id): ...
    def search_runs(self, experiment_ids, filter_string="", run_view_type=ViewType.ACTIVE_ONLY, max_results=SEARCH_MAX_RESULTS_DEFAULT, order_by=None, page_token=None): ...
    def log_batch(self, run_id, metrics=None, params=None, tags=None): ...

Client API

Model Management

Comprehensive model lifecycle management including logging, loading, evaluation, and deployment with support for multiple ML frameworks and custom models.

def log_model(model, artifact_path, **kwargs): ...
def load_model(model_uri, dst_path=None, **kwargs): ...
def evaluate(model=None, data=None, targets=None, model_type=None, evaluators=None, evaluator_config=None, **kwargs): ...
def register_model(model_uri, name, await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS, tags=None, **kwargs): ...

Models

Data Management

Dataset tracking and lineage capabilities supporting multiple data formats including pandas, numpy, Spark, Delta, and HuggingFace datasets with comprehensive metadata management.

def from_pandas(df, source=None, targets=None, name=None, digest=None, predictions=None): ...
def from_numpy(features, source=None, targets=None, name=None, digest=None, predictions=None): ...
def from_spark(df, source=None, targets=None, name=None, digest=None, predictions=None): ...
def log_input(dataset, context=None, tags=None): ...
def log_inputs(datasets, tags=None): ...

Data Management

Tracing and Observability

Distributed tracing system for LLM/GenAI applications providing observability, debugging, and performance monitoring with span management and assessment capabilities.

def trace(name=None, span_type=None, inputs=None, attributes=None): ...
def start_span(name, span_type=None, inputs=None, parent_id=None, attributes=None): ...
def get_trace(request_id): ...
def search_traces(experiment_ids=None, filter_string="", max_results=None, order_by=None, run_id=None): ...
def log_assessment(assessment, request_id=None, run_id=None, timestamp_ms=None): ...

Tracing and Observability

Configuration and System Management

System configuration including tracking URIs, model registry settings, system metrics, and authentication management for MLflow deployments.

def set_tracking_uri(uri): ...
def get_tracking_uri(): ...
def set_registry_uri(uri): ...
def enable_system_metrics_logging(): ...
def disable_system_metrics_logging(): ...
def login(): ...

Configuration

GenAI and LLM Integration

Specialized capabilities for LLM/GenAI workflows including prompt management, LLM evaluation, and integration with popular AI frameworks and libraries.

def load_prompt(model_name, model_version=None, model_alias=None): ...
def register_prompt(prompt, name, version=None, tags=None, description=None, metadata=None): ...
def search_prompts(filter_string=None, max_results=None, order_by=None, page_token=None): ...

GenAI and LLM

ML Framework Integrations

Native integrations with 25+ ML frameworks providing automatic logging, model serialization, and deployment capabilities with framework-specific optimizations.

# Popular integrations (via lazy loading)
import mlflow.sklearn
import mlflow.pytorch  
import mlflow.tensorflow
import mlflow.keras
import mlflow.xgboost
import mlflow.lightgbm
import mlflow.transformers

Framework Integrations

MLflow Projects

Reproducible ML project execution with environment management, parameter validation, and multi-backend support for local, cloud, and containerized workflows.

import mlflow.projects

def run(uri, entry_point="main", version=None, parameters=None, backend="local", backend_config=None, synchronous=True, **kwargs): ...

class SubmittedRun:
    run_id: str
    def wait(self) -> bool: ...
    def get_status(self) -> str: ...
    def cancel(self): ...

MLflow Projects

Types

from mlflow.entities import Experiment, Run, RunInfo, RunData, Metric, Param, RegisteredModel, ModelVersion
from mlflow.tracking.fluent import ActiveRun
from mlflow.client import MlflowClient
from mlflow.exceptions import MlflowException

class Experiment:
    experiment_id: str
    name: str
    artifact_location: str
    lifecycle_stage: str
    tags: Dict[str, str]

class Run:
    info: RunInfo
    data: RunData

class RunInfo:
    run_id: str
    experiment_id: str
    status: str
    start_time: int
    end_time: int
    artifact_uri: str

class ActiveRun:
    info: RunInfo
    data: RunData
    
class MlflowException(Exception):
    error_code: str
    message: str