Skip to main content

Tiny train logger

Project description

🚅🪵 Tiny Train Log 🚅🪵

Structured, queryable logging for ML experiments. Track metrics across machines, merge results into one SQLite database, and analyze everything with plain SQL.

Quick start

pip install tinytrainlog
from tinytrainlog import MetricsLogger

with MetricsLogger("./runs", run_name="lr-sweep-3e4") as log:
    log.set_config({"model": "resnet50", "lr": 3e-4, "epochs": 10})
    log.add_tags(["sweep", "baseline"])

    for epoch in range(10):
        train_loss = train(model, loader)
        log.log_epoch(epoch=epoch, train_loss=train_loss)

        val_loss, val_acc = evaluate(model, val_loader)
        log.log_eval(epoch=epoch, val_loss=val_loss, val_acc=val_acc)

        torch.save(model.state_dict(), log.checkpoint_path(epoch=epoch))

    log.log_test(test_acc=0.94, test_loss=0.21)

Everything lands in a single runs.db SQLite file — query it however you like:

import sqlite3

conn = sqlite3.connect("./runs/runs.db")

# Compare learning rates across runs
conn.execute("""
    SELECT c.run_name, c.value AS lr, e.value AS val_acc
    FROM config c
    JOIN eval e USING (run_name)
    WHERE c.key = 'lr' AND e.key = 'val_acc'
    ORDER BY CAST(e.value AS REAL) DESC
""").fetchall()

Multi-server merging

Ran experiments on multiple machines? Merge them into one database:

MetricsLogger.merge(target_dir="./all_runs", source_dir="/mnt/gpu-box-1/runs")
MetricsLogger.merge(target_dir="./all_runs", source_dir="/mnt/gpu-box-2/runs")

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

tinytrainlog-0.1.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

tinytrainlog-0.1.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tinytrainlog-0.1.4.tar.gz.

File metadata

  • Download URL: tinytrainlog-0.1.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tinytrainlog-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8528e058be01c838629e26f21427ea81db1b683c1aede54ed6860df2427caeac
MD5 69bd20e0443dbc7de75f68227282e308
BLAKE2b-256 fee798233b41b3ef5c71b183d742528b8bb2158e3006fb0e32061282073a7d7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinytrainlog-0.1.4.tar.gz:

Publisher: python-publish.yml on jdhouseholder/tinytrainlog

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

File details

Details for the file tinytrainlog-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: tinytrainlog-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tinytrainlog-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dce14c43115e59e8875903e075bbacb959b5eb2122907eb5211e68d25ce7c5f1
MD5 d6961a879cb2a92a286e5899f0e8a1be
BLAKE2b-256 3ea1322e6e5fdbdfa12ce2126ad6357faaefd83e8a3617f34b3bba67cf6a2f0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinytrainlog-0.1.4-py3-none-any.whl:

Publisher: python-publish.yml on jdhouseholder/tinytrainlog

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