Skip to main content

Tiny train logger

Project description

🚅🪵 Tiny Train Log 🚅🪵

PyPI License: MIT

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.6.tar.gz (4.7 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.6-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tinytrainlog-0.1.6.tar.gz
  • Upload date:
  • Size: 4.7 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.6.tar.gz
Algorithm Hash digest
SHA256 6a5e1196cae1ac83b3d3014b591d12e6f862e313115576abdd2ce03f5236fc51
MD5 2eb3c44700087abe9b488eba57d48348
BLAKE2b-256 367e0341d3fbe3834f7ca1dd3a7130f5045d56f304a1782460af900da2d1c7dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinytrainlog-0.1.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: tinytrainlog-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6754708801f3f05fd2d9bd26e3fdb77a760330deae358134bec6de3ef5bfca43
MD5 b9d4de629ebfbb5f4014a246707a1c9b
BLAKE2b-256 d8f818e9915c98f588c1de00614f38ec42e256dc551acc5cb9a0e00737dec81e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tinytrainlog-0.1.6-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