Skip to main content

Benchmark your models (latency + accuracy) on real edge devices — SDK + tinydevice CLI

Project description

tinyedge — the Python SDK

Benchmark your models on real edge devices from inside any Python pipeline, notebook or CI job. PyTorch (or any framework) stays on your machine — the SDK converts what you give it into the platform's wire formats (ONNX + labeled image archive) and real hardware does the measuring.

pip install git+https://github.com/lienertdemaeyer/tinyedge-agent#subdirectory=sdk
export TINYEDGE_API_KEY=tinyedge_sk_…        # TinyEdge console → New benchmark

In a PyTorch pipeline

import tinyedge

client = tinyedge.TinyEdge()

result = client.benchmark(
    model,                       # a live nn.Module (auto-exported to ONNX) or "model.onnx"
    devices=["oppo-a74"],        # or ["jetson-orin-nano:tensorrt", "raspberry-pi-5"]
    dataset=raw_test_set,        # torch Dataset of (image, label) — UNtransformed,
                                 # or a folder ("./testset"), or an archive (".zip/.tar.gz")
    precision="fp32",
)

print(result)                    # <BenchmarkResult oppo-a74 completed p50=56.6ms top1=83.3%>
print(result.latency_ms_p50, result.accuracy_top1)

Notes that make this work well:

  • Pass the dataset without transforms. Preprocessing (resize/crop/normalize) is part of the standardized job spec and runs on-device — that's what makes accuracy comparable across devices instead of depending on whatever transform happened to run on your laptop.
  • Labels are class indices. Folder names / integer labels map directly to your model's output indices (207/ = output neuron 207).
  • A custom example_input controls the ONNX export shape: client.benchmark(model, ..., example_input=torch.randn(1, 3, 320, 320)).

As a CI gate (pytest)

Fail the build when the model regresses on the hardware you ship on:

# test_edge_performance.py
import tinyedge

def test_detector_meets_edge_budget():
    client = tinyedge.TinyEdge()
    result = client.benchmark("artifacts/model.onnx",
                              devices=["jetson-orin-nano"],
                              dataset="testdata/eval_set.tar.gz")
    result.assert_latency(max_ms=50)
    result.assert_accuracy(min_top1=0.80)

assert_* raise AssertionError with a readable message, so any test runner (pytest, unittest, GitHub Actions) reports it natively.

Async style

jobs = client.benchmark(model, devices=["oppo-a74", "raspberry-pi-5"], wait=False)
# … do other work …
for j in jobs:
    print(client.get(j.id))

What runs where

Your machine (SDK) TinyEdge platform The device (agent)
torch → ONNX export stores artifacts, queues job downloads ONNX + images
dataset → image archive tracks pending/running runs inference, computes accuracy
poll / asserts stores the report uploads metrics only

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

tinyedge-0.4.5.tar.gz (60.5 kB view details)

Uploaded Source

Built Distribution

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

tinyedge-0.4.5-py3-none-any.whl (51.1 kB view details)

Uploaded Python 3

File details

Details for the file tinyedge-0.4.5.tar.gz.

File metadata

  • Download URL: tinyedge-0.4.5.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for tinyedge-0.4.5.tar.gz
Algorithm Hash digest
SHA256 31033b70c5ebec40c62b93a9b33af96556d83b72d4ab077c739098e08b8afd6a
MD5 ec90b3b4446be889783dcadd8ca7c858
BLAKE2b-256 5e5f6a495577783a808ae08d366fb91a8479bf01e97982c5475028ad033b6cb1

See more details on using hashes here.

File details

Details for the file tinyedge-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: tinyedge-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 51.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for tinyedge-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ad9ee386bd1c7daa5b55d15a4dc19b41963eef7529e643d139ef0cde2e8cee97
MD5 7934d95c702bef3d3c40eafc0b2467ba
BLAKE2b-256 17ad6ea643f42c45669bf563041fd6c1ec543918944a4d9b8066d9ddc317b46d

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