Skip to main content

SnapperML

License: MIT PyPI version

SnapperML

SnapperML is a comprehensive framework for experiment tracking and machine learning operationalization (MLOps), built using well-supported technologies like Mlflow, Ray, Docker, and more. It provides an opinionated workflow designed to facilitate both local and cloud-based experimentation.

Key Features

  • Automatic Tracking: Seamless integration with MLflow for parameter and metric tracking.
  • Distributed Training: First-class support for distributed training and hyperparameter optimization using Optuna and Ray.
  • CLI-Based Execution: Easily package and execute projects within containers using our intuitive Command Line Interface (CLI).
  • Web Interface: A modern web interface developed with Vite, React, TypeScript, and Bootstrap for managing experiment configurations.

Project Goals

SnapperML aims to:

  1. Enhance Maintainability: By addressing technical debt and improving the codebase, making it cleaner and more efficient.
  2. Improve Scalability: Ensure the system can handle large-scale experiments and concurrent requests smoothly.
  3. Provide a Robust Web UI: A user-friendly interface that simplifies the setup and execution of ML experiments.
  4. Ensure Reproducibility: Leverage MLOps principles to ensure experiments can be replicated easily.

Architecture

Overview

SnapperML integrates several components to streamline machine learning workflows:

  • CLI Framework: Facilitates command-based interactions and logging for experiment execution.
  • Flask API: Manages requests from the frontend and interfaces with backend processes.
  • Vite-Powered Web UI: An accessible and intuitive web application that handles experiment configurations and tracks real-time logs.
  • Containerized Databases: Securely stores experiment results using containerized MLflow and Optuna databases.

Architecture Overview

Installation

Prerequisites

  • docker
  • python 3.12+
  • node.js (for UI development)

Install

The python package can be install using pip:

pip install snapper-ml

Or from this repo:

pip install .

Deploy

To run SnapperML, you first need to deploy MLflow and Optuna databases. Execute:

snapper-ml make docker

Once the deploy finished you can execute snapper-ml in the CLI. For an ilustrative example, check the example section.

To use snapperML web interface you need to deploy it too.

snapper-ml make UI

Open localhost:4000 and upload your firsts experiments!

UI

To stop snapper UI just execute:

make stop_UI

And to stop mlflow and optuna databases execute:

make stop_docker

Documentation

The documentation is available here

Example

# train_svm.py

from snapper_ml import job

@job
def main(C, kernel, gamma='scale'):
    np.random.seed(1234)
    X_train, X_val, y_train, y_val = load_data()
    model = SVC(C=C, gamma=gamma, kernel=kernel)
    model.fit(X_train, y_train)
    accuracy = model.score(X_val, y_val)
    return {'val_accuracy': accuracy}


if __name__ == '__main__':
    main()
# train_svm.yaml

name: "SVM"
kind: "group"
num_trials: 12
sampler: TPE

param_space:
  C: loguniform(0.01, 1000)
  gamma: choice(['scale', 'auto'])

metric:
  name: val_accuracy
  direction: maximize

ray_config:
  num_cpus: 4

data:
  folder: data/
  files: ["*QGSJet.txt"]

run:
  - train_svm.py

snapper-ml run --config_file=train_svm.yaml

There are more examples in the examples folder.

Metadata

Release files for snapper-ml 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapper-ml 0.4.1
File Size Uploaded Provenance Actions
snapper_ml-0.4.1.tar.gz 2.3 MB Without provenance Details for snapper_ml-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snapper-ml 0.4.1
File Interpreter ABI Platform Actions
snapper_ml-0.4.1-py3-none-any.whl Python 3 none any Details for snapper_ml-0.4.1-py3-none-any.whl

Total release size: 4.6 MB

Release files / snapper_ml-0.4.1.tar.gz

Download URL snapper_ml-0.4.1.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
e162449ddf15eb757c7fc19822acfaafe96ff497606e2d674de8568fb0e9f092
BLAKE2b-256 checksum
How to use checksums
78eb3013e61c2d3adabc09314a9653f38dc525233467840aba9b08d282bcd3d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.7

Release files / snapper_ml-0.4.1-py3-none-any.whl

Download URL snapper_ml-0.4.1-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
97b386e821c92142b888e00157389ca6df3d408a20ba3d550e5fd0b7840523a8
BLAKE2b-256 checksum
How to use checksums
b3c03264fe1a0a1e32369105a68d2046db1cdad5fd64be7159477ff2a0535455
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.7

Security for snapper-ml 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page