Skip to main content

runlocal_hub Logo

Python client for benchmarking and validating ML models on real devices via RunLocal API.

PyPI version Python Versions License: MIT


RunLocal Benchmark Demo

🎯 Key Features

  • ⚡ Real Hardware Testing - No simulators or emulators. Test on real devices maintained in our devices lab
  • 🌍 Cross-Platform Coverage - Access MacBooks, iPhones, iPads, Android, and Windows devices from a single API
  • 🔧 Multiple ML Formats - Support for CoreML, ONNX, OpenVINO, TensorFlow Lite, and GGUF models. More frameworks coming soon.
  • 📊 Detailed Metrics - Measure inference time, memory usage, and per-layer performance data
  • 🚦 CI/CD Ready - Integrate performance and accuracy testing into your deployment pipeline

🔍 Evaluate Results

All benchmarks performed through the python client can be evaluated on the web platform by logging into your account. Check out our public demo for comprehensive benchmark evaluation across different devices and model formats.

🛠 Installation

Using uv

Add to your project with uv:

uv add runlocal-hub

Then run:

uv sync

Using pip

pip install runlocal-hub

Development Installation

For development or to install from source using uv:

git clone https://github.com/neuralize-ai/runlocal_hub.git
cd runlocal_hub
uv sync

🔑 Authentication

Get your API key from the RunLocal dashboard:

  1. Log in to RunLocal
  2. Click your avatar → User Settings
  3. Navigate to "API Keys"
  4. Click "Create New API Key"
  5. Save your key securely
export RUNLOCAL_API_KEY=<your_api_key>

🕹 Usage Guide

Simple Benchmark

from runlocal_hub import RunLocalClient, display_benchmark_results

client = RunLocalClient()

# Benchmark on any available device
response = client.benchmark("model.mlpackage")
display_benchmark_results(response.results)

Device Filtering

Target specific devices with intuitive filters:

from runlocal_hub import DeviceFilters, RunLocalClient

client = RunLocalClient()

# High-end MacBooks with M-series chips
mac_filters = DeviceFilters(
    device_name="MacBook",
    soc="Apple M",        # Matches M1, M2, M3, etc.
    ram_min=16,           # At least 16GB RAM
    year_min=2021         # Recent models only
)

# Latest iPhones with Neural Engine
iphone_filters = DeviceFilters(
    device_name="iPhone",
    year_min=2022,
    compute_units=["CPU_AND_NE"]
)

# Run benchmarks
response = client.benchmark(
    "model.mlpackage",
    device_filters=[mac_filters, iphone_filters],
    count=None  # Use all matching devices
)

🧮 Running Predictions

Test your model with real inputs:

import numpy as np

# Prepare input
image = np.random.rand(1, 3, 224, 224).astype(np.float32)
inputs = {"image": image}

# Run prediction on iPhone
response = client.predict(
    inputs=inputs,
    model_path="model.mlpackage",
    device_filters=DeviceFilters(device_name="iPhone 15", compute_units=["CPU_AND_NE"])
)

outputs = response.results.outputs

tensors = outputs["CPU_AND_NE"]
for name, path in tensors.items():
    tensor = np.load(path)
    print(f"  {name}: {tensor.shape} ({tensor.dtype})")
    print(f"  First values: {tensor.flatten()[:5]}")

📚 Examples

Check out the example scripts:

  • bench.py - Simple benchmarking example
  • predict.py - Prediction with custom inputs, serialised outputs

To run the examples:

# Make sure you have set your API key
export RUNLOCAL_API_KEY=<your_api_key>

# Run benchmark example
uv run examples/bench.py

# Run prediction example
uv run examples/predict.py

💠 Supported Formats

Format Extension Platforms
CoreML .mlpackage/.mlmodel macOS, iOS
ONNX .onnx Windows, MacOS
OpenVINO directory (.xml + .bin) Windows (Intel)
TensorFlow Lite .tflite Android
GGUF .gguf All platforms

More frameworks coming soon.

📜 License

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

Metadata

Release files for runlocal-hub 0.1.7

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

Source distribution (sdist)

Source distribution for runlocal-hub 0.1.7
File Size Uploaded
runlocal_hub-0.1.7.tar.gz 34.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runlocal-hub 0.1.7
File Interpreter ABI Platform
runlocal_hub-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 80.4 kB

Release files / runlocal_hub-0.1.7.tar.gz

Download URL runlocal_hub-0.1.7.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1de2140582d20f073ab86d2ab6b23f8a242d6db05c28b7de5b18b504d87eaf91
BLAKE2b-256 checksum
How to use checksums
9fa9f09907549cfb12c73527695a360874fff8f1637e722b68f573e10c359e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / runlocal_hub-0.1.7-py3-none-any.whl

Download URL runlocal_hub-0.1.7-py3-none-any.whl
Size 46.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c38daf5d592d158fde3fb6a4371912a6c72074d3137228139dc38aa5faaa5043
BLAKE2b-256 checksum
How to use checksums
689a175ffe0be9efc36c714ebbdaee770d75587334cfae3c92b8145ead9e0a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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