Skip to main content

Emit structured benchmark records from your training and experiment scripts.

Project description

benchpress-sdk

Emit structured benchmark records from your training and experiment scripts.

benchpress-sdk is a tiny, dependency-free logging shim. You call a few functions — start_run, log_metrics, log_device, log_artifact, end_run — and it writes structured records to stdout, one per line, in a simple [BENCH:<KIND>] <json> format. A runner that launches your script reads those lines back. Because everything crosses the process boundary as text on stdout, your script needs nothing from the runner and stays decoupled from it.

  • Zero required dependencies — pure standard library at import time.
  • Python 3.6+ — works in older training environments.
  • Framework-agnostic — metric values from torch / numpy / plain floats are coerced for you.

Install

pip install benchpress-sdk
import benchpress

The distribution is named benchpress-sdk; you import it as benchpress.

Quickstart

import benchpress

params = benchpress.start_run(run_name="demo", params={"lr": 0.01, "epochs": 3})
benchpress.log_device("cpu")

for step in range(params["epochs"]):
    loss = 1.0 / (step + 1)
    benchpress.log_metrics({"loss": loss}, step=step)

benchpress.end_run("FINISHED")

Run it and the records appear on stdout:

[BENCH:START]   {"run_id": "...", "run_name": "demo", ...}
[BENCH:DEVICE]  {"device": "cpu", ...}
[BENCH:METRICS] {"step": 0, "metrics": {"loss": 1.0}, ...}
...
[BENCH:END]     {"status": "success", "duration": ...}

Declaring inputs

A runner can inject --key=value flags. Declare each one inline, next to the code that uses it:

from benchpress.sdk import DeclareArg

data_path = DeclareArg("data_path", str, "./data.csv", "Path to the input file")

Run standalone and the default is used; run under a runner and the injected value is picked up.

Saving synthetic arrays (optional)

save_synthetic writes an array as .npy plus a flat .csv. It needs numpy + pandas, kept as an optional extra so the base install stays dependency-free:

pip install "benchpress-sdk[sdk]"

The wire format

One record per line on stdout:

[BENCH:<KIND>] <single-line-json>

<KIND> is one of START, DEVICE, METRICS, ARTIFACT, TAG, END. Lines that don't match are treated as ordinary log output and passed through untouched. Each record is flushed immediately, so a reader sees it in real time — even across a pipe into WSL or a container.

License

Apache-2.0 — see LICENSE and NOTICE.

Learn more at benchpress.run.

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

benchpress_sdk-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

benchpress_sdk-0.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: benchpress_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for benchpress_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db8625d045afb2f74e09d7ecf4d6243df233f71b7ee67a6bf153502c86db1bef
MD5 10907809298aa00f3581d5589b65f8bd
BLAKE2b-256 b704c2c6ef899b45450b641a20c79766bf45029aa1d83f1faff473cc304152e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for benchpress_sdk-0.1.0.tar.gz:

Publisher: release.yml on benchpress-run/benchpress-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: benchpress_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for benchpress_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 751fe1ed0bce427192120e2f93407aefe97da218ace030baaca38e0b59c23223
MD5 386a8dddf3c93a2450b0870ae140dab0
BLAKE2b-256 ec9fb266604285acd351805061ad3064c96a7533e871fb24bee98d03c9c8befd

See more details on using hashes here.

Provenance

The following attestation bundles were made for benchpress_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on benchpress-run/benchpress-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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