Skip to main content

JSONL logging library for live training visualization in Spectria

Project description

spectria-python

JSONL logging library + HTTP/SSE server for live training visualization in Spectria.

A lightweight alternative to TensorBoard with a cleaner, more intentional visualization experience.

Usage

In your training script — log metrics (generic)

pip install spectria
from spectria.logger import RunWriter

writer = RunWriter(project="mnist", run="baseline", config={"lr": 0.01})
writer.write_row({"epoch": 0, "loss": 0.69, "accuracy": 0.51})

Keras integration

pip install spectria[keras]
from spectria.logger import SpectriaCallback, as_keras_callback

model.fit(x, y, callbacks=[
    as_keras_callback(SpectriaCallback(
        project="mnist",
        run="baseline",
        config={"model": "resnet50", "lr": 0.01, "optimizer": "adam", "batch_size": 64},
    ))
])

Runs with a shared baseline are grouped in Spectria:

as_keras_callback(SpectriaCallback(
    project="mnist",
    run="lr-0.001",
    baseline="baseline",
    config={"model": "resnet50", "lr": 0.001, "optimizer": "adam", "batch_size": 64},
))

Visualize — serve the logs

uvx spectria serve

Then open Spectria, click Connect, enter http://localhost:8420, and select your runs.

Options:

spectria serve --logdir ./spectria_logs --port 8420 --host 127.0.0.1

API Endpoints

Endpoint Description
GET /api/projects List all projects
GET /api/projects/{name}/runs List runs with metadata
GET /api/projects/{name}/runs/{run}/data Full JSON snapshot
GET /api/projects/{name}/runs/{run}/events SSE stream for live data

Data Format

Training events are stored as JSONL:

# {"spectria_version":1,"project":"mnist","run":"lr-0.001","baseline":"baseline","config":{"lr":0.001},"created_at":1714732800}
{"epoch":0,"loss":0.6931,"accuracy":0.5123,"_ts":1714732800}
{"epoch":1,"loss":0.4201,"accuracy":0.8102,"_ts":1714732806}

License

MIT

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

spectria-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

spectria-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spectria-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for spectria-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3953b9e38deafded4c02bd7d15656dda24992d6083ad70c5c7364472ba3614df
MD5 05e8d1d2845821f9f94ce21198fa654b
BLAKE2b-256 f3667cfb265fb8c2cbb2663a7bf45e80fbae78b1a7fbdb446435b42a907dbc61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spectria-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for spectria-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c3b27e2c2afed029ffa2736d3c7ef1dedac437762448e32d9aedc5de2e8bfe4
MD5 edeb9bcfec6fced93231ebfc76c90631
BLAKE2b-256 aa3861f029099680047e94d9862e2ca59403c824f5ae5ff891d62c9534eae69e

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