hectorLop / mixver

Custom versioning of Machine Learning models

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Custom versioning of ML models.


About The Project

Mixver is a versioning tool for ML models built enterily with Python. Its main capability is the ease of use and integration with different storage platforms such as AWS.

Built With

  • Python

Getting Started

Installation

Install the package using pip:

pip install mixver

Usage

This example shows how to version ML models locally. First, we need to initialize the storage in the desired path.

from mixver.storages.local_storage import LocalStorage

storage = LocalStorage(storage_path="local_folder/storage")

Once the storage it's initialized, we can push any model we want with its corresponding metadata.

from sklearn.linear_model.LogisticRegression

model = LogisticRegression()
metadata = {"accuracy": 0.8}
name = "test_model"
tags = ["latest", "training"]

storage.push(model, name=name, metadata=metadata, tags=tags)

With this code we are versioning a LogisticRegression model that achieved an accuracy of 0.8 during training. Note that we also add two tags to it, the "latest" for representing the latest trained model, and the "training" tag to represent the model which best performed on the training data. Thus, we can retrieve the model which has this any of this tags assigned.

The following code retrieves the model with the tag "latest", which can be the newest model created. Besides, we can also retrieve the model with the "training" tag, which is the model that best performed in the training data.

On the other hand, we can also retrieve a model if we pass its name and version. In the case, we don't pass any specific version, it will return the newest version of the model

# Get the model with "latest" tag
latest_model = storage.pull(tag="latest")
# Get the model with "training" tag
best_model_training = storage.pull(tag="training")

# Get the version 1 of "test_model"
model_version_1 = storage.pull(name="test_model", version="1")
# Get the latest version of "test_model"
model_latest_version = storage.pull(name="test_model")

Visualize the stored artifacts

storage = LocalStorage(...)
storage.visualize()

An output example would be the following:

Logo

Roadmap

  • Show the models and their latest versions in the CLI
  • Show the tags and their corresponding models in the CLI
  • Add AWS S3 storage
  • Add Google Drive storage

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Hector Lopez Almazan - @hectorLop_- lopez.almazan.hector@gmail.com

About

Custom versioning of Machine Learning models

License:MIT License


Languages

Language:Python 96.4%Language:Makefile 3.6%