Skip to main content

Universal ML tracking tool for teams

Project description

🚀 MLTrack

Drop-in MLflow enhancement with powerful CLI for ML deployment

Test Status PyPI Version License Documentation GitHub Stars

FeaturesQuick StartDocumentationExamplesContributing


🔄 MLflow Compatible

MLTrack is a drop-in enhancement for MLflow, not a replacement. Your existing code keeps working:

# Your existing MLflow code works unchanged
import mlflow
mlflow.start_run()
mlflow.log_param("alpha", 0.5)
mlflow.log_metric("rmse", 0.876)
mlflow.end_run()

# Just add MLTrack for deployment superpowers
from mltrack import get_last_run, deploy
deploy(get_last_run(), platform="modal")
# Deploy the last run from the CLI
mltrack deploy --last --platform modal

🎯 Why MLTrack?

Stop experimenting. Start shipping.

MLTrack is a drop-in enhancement for MLflow that focuses on what matters: getting models into production. While MLflow handles experiment tracking beautifully, MLTrack adds the missing pieces for the complete ML lifecycle: Build → Deploy → Monitor.

# Works with your existing MLflow code
import mlflow
from mltrack import track

@track  # Automatic MLflow tracking + deployment readiness
def train_model(learning_rate=0.01, batch_size=32):
    model = train(learning_rate, batch_size)
    return model
# One command to production
mltrack deploy --last --platform modal
# Or from Python
from mltrack import get_last_run, deploy
deploy(get_last_run(), platform="modal")

✨ Features

🏗️ Build: Enhanced MLflow Tracking

  • Drop-in replacement for MLflow with zero config changes
  • Simple @track decorator adds deployment metadata automatically
  • Works with all MLflow features - just better UI and workflows

🚀 Deploy: Production in One Command

  • Modal: Serverless GPU deployment with auto-scaling
  • AWS Lambda: Cost-effective for lightweight models
  • Docker: For Kubernetes, ECS, or any container platform
  • Automatic FastAPI endpoints with OpenAPI documentation
  • Built-in model versioning and rollback

📊 Monitor: Know What's Happening

  • Real-time inference metrics and latency tracking
  • Model drift detection and alerts
  • Cost analysis (compute + LLM tokens)
  • A/B testing and canary deployments built-in

💼 Enterprise Ready

  • Works with existing MLflow tracking servers
  • Integrates with your current CI/CD pipelines
  • Multi-user support with SSO/SAML
  • Audit logs and compliance features

🎯 Built for Real ML Teams

  • Stop juggling notebooks, scripts, and YAML configs
  • Go from experiment to production endpoint in minutes
  • Monitor actual business impact, not just model metrics
  • Scale from POC to production without rewrites

🎮 Powerful CLI

MLTrack provides a comprehensive CLI that makes ML operations as simple as web development.

Note: You can use either mltrack or the shorter ml command - they're identical!

# Training shortcuts
mltrack train script.py --params learning_rate=0.01 batch_size=32
mltrack train --last  # Re-run last experiment with same params
mltrack train --best  # Re-run best performing experiment

# Deployment commands
mltrack deploy --last --platform modal  # Deploy last trained model
mltrack deploy --best accuracy --platform lambda  # Deploy best model by metric
mltrack deploy --run-id abc123 --platform docker --push-to ecr

# Model management
mltrack models list  # List all registered models
mltrack models promote fraud-detector --from staging --to production
mltrack models rollback fraud-detector  # Instant rollback

# Monitoring and logs
mltrack logs fraud-detector --tail  # Stream production logs
mltrack metrics fraud-detector --window 1h  # Recent performance
mltrack alerts create --model fraud-detector --metric latency --threshold 100ms

# Batch operations
mltrack experiments clean --older-than 30d  # Cleanup old experiments
mltrack deploy-all models.yaml  # Deploy multiple models from config
mltrack benchmark --models v1,v2,v3 --dataset test.csv  # Compare models

# Integration with Unix tools
mltrack list --format json | jq '.[] | select(.metrics.accuracy > 0.9)'
mltrack export --run-id abc123 | aws s3 cp - s3://models/model.pkl

# UI commands
ml ui          # Launch modern MLTrack UI (default port 3000)
ml ui --port 8080  # Custom port
ml flow        # Launch classic MLflow UI (default port 5000)

CLI Highlights

  • Intuitive shortcuts: Common workflows in single commands
  • Unix-friendly: Pipe-able, scriptable, automation-ready
  • Smart defaults: --last, --best flags for quick access
  • Batch operations: Handle multiple models/experiments at once
  • Real-time monitoring: Stream logs and metrics from production

🚀 Quick Start

Installation

uv add ml-track

Basic Usage

# 1. BUILD - Works with your existing MLflow code
from mltrack import track, get_last_run, deploy
import mlflow

@track  # Enhances MLflow tracking
def train_model(n_estimators=100, max_depth=10):
    # Your normal training code
    model = RandomForestClassifier(n_estimators=n_estimators, max_depth=max_depth)
    model.fit(X_train, y_train)
    
    # Log metrics as usual with MLflow
    mlflow.log_metric("accuracy", accuracy_score(y_test, model.predict(X_test)))
    mlflow.sklearn.log_model(model, "model")
    
    return model
model = train_model(n_estimators=150)

# Deploy via Python
deployment = deploy(
    get_last_run(),
    platform="modal",
    name="fraud-detection-v1",
)
print(f"Model deployed to: {deployment.get('endpoint_url')}")

# Docker image
deploy(get_last_run(), platform="docker", name="fraud-detection-v1")

# Lambda package
deploy(
    get_last_run(),
    platform="lambda",
    name="fraud-detection-v1",
    lambda_zip_path="fraud-detection-v1-lambda.zip",
)
# 2. DEPLOY - One line to production
mltrack deploy --last --platform modal --name fraud-detection-v1

# 3. MONITOR - Track production performance
mltrack ui  # http://localhost:3000/deployments/fraud-detection-v1

The Full Workflow

# Start with your existing MLflow setup
export MLFLOW_TRACKING_URI=http://your-mlflow-server:5000

# Add MLTrack for better UI and deployment
uv add ml-track

# Train and deploy in one script
python train.py  # Tracks with MLflow, deploys with MLTrack

# Monitor everything in one place
mltrack ui  # Beautiful dashboard at http://localhost:3000

📚 Documentation

🎓 Examples

Computer Vision

from mltrack import track
import torch
import torchvision

@track(project="image-classification")
def train_resnet(learning_rate=0.001, epochs=10):
    model = torchvision.models.resnet18(pretrained=True)
    # Training code...
    return model

Natural Language Processing

from mltrack import track
from transformers import AutoModelForSequenceClassification

@track(project="sentiment-analysis") 
def fine_tune_bert(model_name="bert-base-uncased", batch_size=16):
    model = AutoModelForSequenceClassification.from_pretrained(model_name)
    # Fine-tuning code...
    return model

LLM Applications

from mltrack import track_llm
from openai import OpenAI

client = OpenAI()

@track_llm(name="rag-query")
def test_rag_pipeline(question: str, temperature=0.7):
    # Your RAG implementation
    return client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": question}],
        temperature=temperature,
    )

response = test_rag_pipeline("Test query")
print(response.choices[0].message.content)

🏗️ Architecture

graph TD
    A[Your ML Code] -->|Existing MLflow calls| B[MLflow Tracking Server]
    A -->|@track decorator| C[MLTrack Enhancement Layer]
    C --> B
    C --> D[MLTrack Deployment Service]
    D --> E[Modal/Lambda/Docker]
    C --> F[MLTrack UI]
    F --> G[Monitoring Dashboard]
    B --> H[(MLflow Store)]
    
    style C fill:#7c3aed,color:#fff
    style D fill:#7c3aed,color:#fff
    style F fill:#7c3aed,color:#fff

Key Points:

  • MLTrack sits alongside MLflow, not in front of it
  • Your MLflow tracking server stays unchanged
  • MLTrack adds deployment and monitoring capabilities
  • All MLflow features remain accessible

🤝 Contributing

We love contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/EconoBen/mltrack.git
cd mltrack

# Install in development mode
pip install -e ".[dev]"

# Install frontend dependencies
cd frontend
npm install

# Run tests
pytest
npm test

Code Style

  • Python: Black + isort + flake8
  • TypeScript: ESLint + Prettier
  • Pre-commit hooks included

🗺️ Roadmap

  • v0.2.0 - AutoML integration and hyperparameter tuning
  • v0.3.0 - Distributed training support
  • v0.4.0 - Model monitoring and drift detection
  • v0.5.0 - Kubernetes operator for deployment
  • v1.0.0 - Production-ready with enterprise features

See our full roadmap for more details.

🙏 Acknowledgments

MLTrack is built on the shoulders of giants:

📝 License

MLTrack is MIT licensed. See the LICENSE file for details.

🌟 Star History


Made with ❤️ by the MLTrack community

TwitterDiscordWebsite

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

mltrack_py-0.2.0.tar.gz (578.9 kB view details)

Uploaded Source

Built Distribution

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

mltrack_py-0.2.0-py3-none-any.whl (126.3 kB view details)

Uploaded Python 3

File details

Details for the file mltrack_py-0.2.0.tar.gz.

File metadata

  • Download URL: mltrack_py-0.2.0.tar.gz
  • Upload date:
  • Size: 578.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for mltrack_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 376c58e562ff0e6adf81c2c7eff3ede5ce8d2bdf3c7e5272b3b7bc4b4212bf77
MD5 48504f3aee42afb101b596a6b3ecf0fd
BLAKE2b-256 75c62c9a484acbd6c7393b355b3448b0499f4f7b9c53c30edae6f8bf0fb9e327

See more details on using hashes here.

File details

Details for the file mltrack_py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mltrack_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 126.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for mltrack_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd762725def94e20244928adda187f017be8e970690acf7baa6b354e9db6de0a
MD5 4987021fa0e359aac83bf51f9ff6b085
BLAKE2b-256 d9f399a99499a39d1c12c8975b2b4a812d904681e1f2db11541053a340673b40

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