Skip to content

thesebsterseb/mimaas-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIMaaS Python SDK

Python client library for the MIMaaS (Microcontroller Model as a Service) API. Submit TensorFlow Lite models, benchmark them on real microcontroller hardware, and get back detailed performance metrics — all without touching a single board.

Installation

pip install -e .

With power analysis visualization:

pip install -e ".[viz]"

Quick Start

from mimaas import MIMaaSClient

client = MIMaaSClient()
client.login("your_username", "your_password")

# Submit a model for evaluation
request = client.submit_request("model.tflite", "nrf5340dk")

# Wait for results
results = client.wait_for_completion(request.id)
print(results)

Output:

Results:
  Inference Time: 12.34 ms
  Energy: 45.67 µJ
  Power: 3702.10 µW
  RAM: 48.2 KB
  Flash: 112.5 KB

Configuration

The client resolves settings in this order (first match wins):

Priority Source Example
1 Constructor arguments MIMaaSClient(api_url="...")
2 Environment variables MIMAAS_API_URL, MIMAAS_API_TOKEN, MIMAAS_TIMEOUT
3 Config file ~/.mimaas/config.yaml
4 Defaults Built-in defaults

Config file example (~/.mimaas/config.yaml):

api_url: https://api.mimaas.com
timeout: 120

Usage

Account Management

# Register a new account
client.register(
    username="johndoe",
    email="john@example.com",
    first_name="John",
    surname="Doe",
    password="secure_password",
    plan="free"
)

# Check your profile and remaining runs
profile = client.get_profile()
print(f"Runs remaining: {profile.available_runs}")

# View available plans
plans = client.list_plans()

Browse Available Boards

boards = client.list_boards()
for board in boards:
    print(board)

# Check a specific board
board = client.get_board("nrf5340dk")
status = client.get_board_status("nrf5340dk")

Submit and Track Requests

# Validate before submitting (does not consume a run)
result = client.validate_model("model.tflite", "nrf5340dk")

# Submit for evaluation
request = client.submit_request("model.tflite", "nrf5340dk", quantize=False)

# Poll manually
req = client.get_request(request.id)
print(req.status)  # "pending" | "processing" | "done" | "error"

# Or block until done
results = client.wait_for_completion(request.id, timeout=600)

# List past requests
all_requests = client.list_requests()
done = client.list_requests(status="done", board="nrf5340dk")

Download Artifacts

client.download_ram_report(request.id, "ram.json")
client.download_rom_report(request.id, "rom.json")
client.download_power_summary(request.id, "ppk2_summary.csv")
client.download_power_samples(request.id, "ppk2_samples.csv")
client.download_model(request.id, "model.tflite")

# Or grab everything at once
client.download_all_artifacts(request.id, "artifacts.zip")

Power Analysis Visualization

Requires the viz extra (pip install -e ".[viz]").

from mimaas.viz import plot_power_analysis

fig = plot_power_analysis("ppk2_samples.csv")
fig.show()

Generates an interactive Plotly dashboard with current draw over time, distribution histograms, and per-inference statistics.

About

The API to use MIMaaS directly in your favorite IDE! :)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages