MLflow.js is an open-source JavaScript library that helps developers track machine learning experiments and manage models with MLflow, providing functionalities for machine learning lifecycle in JavaScript/TypeScript environments.
MLflow.js covers all REST API endpoints under MLflow's Tracking Server and Model Registry. Moreover, high-level abstractions have been developed to facilitate developers' common ML workflows. It provides some key advantages:
- Native JavaScript Integration: Seamlessly integrate MLflow capabilities within JavaScript codebases
- Type Safety: Built with TypeScript for enhanced developer experience and code reliability
- Modular Architecture: Designed with object-oriented structure that mirrors MLflow's concepts while being extensible and maintainable
- Client-side ML Compatibility: Complements popular JavaScript libraries like TensorFlow.js, enabling ML deployment directly in the browser or client side
Ensure MLflow is installed on your system:
pip install mlflow
Note: MLflow is compatible with MacOS. If you encounter issues with the default system Python, consider installing Python 3 via the Homebrew package manger using brew install python
. In this case, installing MLflow is now pip3 install mlflow
.
To start the MLflow tracking server locally, use the following command:
mlflow ui --port 5001
This will launch the MLflow UI on your local machine at http://localhost:5001
.
Install Docker Desktop.
To start the MLflow tracking server locally, use the following commands:
docker pull ghcr.io/mlflow/mlflow
docker run -p 5001:5001 ghcr.io/mlflow/mlflow:latest mlflow server --host 0.0.0.0 --port 5001
This will launch the MLflow UI on your local machine at http://localhost:5001
.
For development environment setup instructions, please refer to our Contributing Guide.
To use the mlflow.js library, navigate to your project directory and install it via npm:
npm install mlflow-js
Here is an example of how to use the mlflow.js library to create an experiment:
import Mlflow from 'mlflow-js';
// Initialize the MLflow client
const mlflow = new Mlflow(process.env.MLFLOW_TRACKING_URI);
// Create a new experiment
async function createExperiment(){
await mlflow.createExperiment('My Experiment');
console.log('Experiment created successfully');
}
createExperiment();
- Example Repository - Practical examples demonstrating MLflow.js's functionality
- Quick Tutorials - Video walkthrough of the example code with MLflow UI
- Read our Medium Article - Overview on why we built MLflow.js and how it enhances ML workflows in JavaScript environments
Official documentation for MLflow.js can be found here.
Experiment Manager
- runExistingExperiment - Full workflow of creating, naming, and starting a run under an existing experiment, logging metrics, params, tags, and the model, and finishing the run
- runNewExperiment - Full workflow of creating, naming, and starting a run under a new experiment, logging metrics, params, tags, and the model, and finishing the run
- experimentSummary - Returns an array of all the passed-in experiment's runs, sorted according to the passed-in metric
Run Manager
- cleanupRuns - Deletes runs that do not meet certain criteria and return an object of deleted runs and details
- copyRun - Copies a run from one experiment to another (without artifacts and models)
Model Manager
- createRegisteredModelWithVersion - Creates a new registered model and the first version of that model
- updateRegisteredModelDescriptionAndTag - Updates a registered model's description and tags
- updateAllLatestModelVersion - Updates the latest version of the specified registered model's description, adds a new alias, and tag key/value for the latest version
- setLatestModelVersionTag - Adds a new tag key/value for the latest version of the specified registered model
- setLatestModelVersionAlias - Adds an alias for the latest version of the specified registered model
- updateLatestModelVersion - Updates the description of the latest version of a registered model
- updateAllModelVersion - Updates the specified version of the specified registered model's description and adds a new alias and tag key/value for that specified version
- deleteLatestModelVersion - Deletes the latest version of the specified registered model
- createModelFromRunWithBestMetric - Creates a new model with the specified model name from the run with the best specified metric
We welcome contributions to MLflow.js! Please see our Contributing Guide for more details on how to get started.
Name | GitHub | |
---|---|---|
Yiqun Zheng | ||
Kyler Chiago | ||
Austin Fraser | ||
Stephany Ho | ||
Winston Ludlam |