Skip to main content

A lightweight MLOps monitoring solution for edge devices

Project description

Lightweight Edge MLOps Monitor

A minimal Python library and agent designed specifically for monitoring machine learning models deployed on resource-constrained edge devices (e.g., IoT sensors, embedded systems running Linux).

Overview

The Lightweight Edge MLOps Monitor provides essential monitoring capabilities for ML models running on edge devices with limited resources:

  • System Health Monitoring: Track CPU and memory usage with minimal overhead
  • Model Input/Output Logging: Log model inputs and outputs for analysis
  • Drift Detection: Detect statistical drift in model outputs using the Kolmogorov-Smirnov test
  • Telemetry Upload: Efficiently batch and upload telemetry data to cloud storage when network connectivity is available

Key Features

  • Resource Efficient: Optimized for devices with constrained CPU, memory, and power
  • Minimal Dependencies: Uses only essential libraries (psutil, scipy, boto3, PyYAML)
  • Type Safe: Fully typed with Python 3.10+ type hints and mypy compatibility
  • Robust Error Handling: Graceful handling of network failures, disk full scenarios, and other edge cases
  • Configurable: Easily adjust sampling rates, buffer sizes, and other parameters via YAML configuration

Installation

pip install edge-mlops-monitor

Or install from source:

git clone https://github.com/Edmon02/edge-mlops-monitor.git
cd edge-mlops-monitor
pip install -e .

Quick Start

  1. Create a configuration file config.yaml:
system:
  sampling_interval_seconds: 10
  max_memory_buffer_mb: 50

model_logging:
  buffer_size: 1000
  log_level: INFO

drift_detection:
  algorithm: ks_test
  threshold: 0.05
  reference_data_path: "/path/to/reference_data.json"
  check_frequency: 100  # Check after every 100 predictions

telemetry:
  upload_interval_seconds: 300
  max_batch_size: 100
  retry_base_delay_seconds: 1
  retry_max_delay_seconds: 60
  retry_max_attempts: 5

storage:
  type: "s3"
  bucket: "your-telemetry-bucket"
  prefix: "edge-device-1/"
  sqlite_path: "/path/to/local/buffer.db"
  max_sqlite_size_mb: 100
  1. Use the monitor in your ML application:
from edge_mlops_monitor import EdgeMonitor

# Initialize the monitor
monitor = EdgeMonitor(config_path="config.yaml")

# Start system monitoring in the background
monitor.start_system_monitoring()

# In your ML inference loop
def predict(input_data):
    # Log the input
    input_id = monitor.log_model_input(input_data)
    
    # Make prediction with your model
    prediction = my_model.predict(input_data)
    
    # Log the output
    monitor.log_model_output(input_id, prediction)
    
    return prediction

# When shutting down
monitor.stop()

Documentation

For detailed documentation, please see:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

edge_mlops_monitor-0.1.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

edge_mlops_monitor-0.1.0-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file edge_mlops_monitor-0.1.0.tar.gz.

File metadata

  • Download URL: edge_mlops_monitor-0.1.0.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for edge_mlops_monitor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de64e0747b894360cfc455285afd9a8091089dcabf62c16114379835fe80b06a
MD5 3b9b48a1d9397fbcb345275ca5db2e36
BLAKE2b-256 8e454e32716cc4708ed0ff49fdf5c95c4aabc2ea4312b77b3686dfa6776af667

See more details on using hashes here.

File details

Details for the file edge_mlops_monitor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for edge_mlops_monitor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c370585fac4c9ffe1eeb3f8e04f77ace55e8be5aa73a208d97bfff442892b3
MD5 ed97fbf6e47fd8610e81789526634b86
BLAKE2b-256 52deff71f0652f8968635463d6b3cd163e3ea72ddf7c1c0e0f9ad1a599a595b8

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