Skip to content

JavaScript client library for MLflow, providing functionalities for machine learning lifecycle

License

Notifications You must be signed in to change notification settings

oslabs-beta/mlflow-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


About

License: MIT Release Build Coverage Contributions

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.


Features

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

Built with

TypeScript JavaScript React Next.js TailwindCSS ESLINT Node.js Jest GitHub Actions Docker NPM Vercel


Prerequisites

Set Up MLflow

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.

Start the MLflow Tracking Server

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.

Alternative Docker approach to the MLflow Tracking Server

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.

Development Setup

For development environment setup instructions, please refer to our Contributing Guide.


Quickstart

Install mlflow.js Library

To use the mlflow.js library, navigate to your project directory and install it via npm:

npm install mlflow-js

Usage Example

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();

Resources


Documentation

Official documentation for MLflow.js can be found here.

High-Level Workflows

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

Contributing

We welcome contributions to MLflow.js! Please see our Contributing Guide for more details on how to get started.


License

MIT License


Meet The Team

Name GitHub LinkedIn
Yiqun Zheng GitHub LinkedIn
Kyler Chiago GitHub LinkedIn
Austin Fraser GitHub LinkedIn
Stephany Ho GitHub LinkedIn
Winston Ludlam GitHub LinkedIn