Skip to main content

Record experiment data easily

Project description

record-keeper

Installation

pip install record-keeper

The Problem:

When running machine-learning experiments, having more logged data is usually better than less. But adding new series of data to log can often require changes to your training code. When you want to log dozens of different series of data, your code starts to look awful.

The Solution:

Use RecordKeeper, and easily add loggable information when you write a new class. The example below is modified from the pytorch-metric-learning library.

First, create a list that contains the names of the attributes you want to record (self._record_these in the example below).

class BatchHardMiner(BaseTupleMiner):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self._record_these = ["hardest_triplet_dist", "hardest_pos_pair_dist", "hardest_neg_pair_dist"]

Then tell RecordKeeper the name of the list to read. RecordKeeper will log and save all the attributes described in the list. It'll search recursively too, if you have nested objects.

from torch.utils.tensorboard import SummaryWriter
import record_keeper as record_keeper_package
from pytorch_metric_learning import miners

record_writer = record_keeper_package.RecordWriter(your_folder_for_logs)
tensorboard_writer = SummaryWriter(log_dir=your_tensorboard_folder)
record_keeper = record_keeper_package.RecordKeeper(tensorboard_writer, record_writer, ["_record_these"])

your_miner_dictionary = {"tuple_miner": miners.BatchHardMiner()}

# Then at each iteration of training:
record_keeper.update_records(your_miner_dictionary, current_iteration)

Now the attributes described in _record_these, (specifically, hardest_triplet_dist, hardest_pos_pair_dist, and hardest_neg_pair_dist) can be viewed on Tensorboard.

These data series are also saved in sqlite and CSV format. If you only want to use Tensorboard, then pass in only a SummaryWriter, and vice versa.

The dictionary that you pass into record_keeper.update_records can contain any number of objects, and for each one, RecordKeeper will check if the object has a "record_these" attribute. As long as you're making your dictionaries programmatically, it's possible to add large amounts of loggable data without clogging up your training code. See pytorch-metric-learning and powerful-benchmarker to see RecordKeeper in action.

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

record-keeper-0.9.31.dev6.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

record_keeper-0.9.31.dev6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file record-keeper-0.9.31.dev6.tar.gz.

File metadata

  • Download URL: record-keeper-0.9.31.dev6.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for record-keeper-0.9.31.dev6.tar.gz
Algorithm Hash digest
SHA256 22fc0e09191ecde8594dff75de61ccc8f51f9444b84406fb684c7b65bc92e8bb
MD5 c8dcdfccff1b1176e686b5359e7376ba
BLAKE2b-256 3d64fde71edaa6f4d728e142d60fd911d8ef4365162e940ce29ff73fbb564d95

See more details on using hashes here.

File details

Details for the file record_keeper-0.9.31.dev6-py3-none-any.whl.

File metadata

  • Download URL: record_keeper-0.9.31.dev6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

File hashes

Hashes for record_keeper-0.9.31.dev6-py3-none-any.whl
Algorithm Hash digest
SHA256 93998e9319822cc93a2e694d72a159c0664ec7a3322694c9201b49bbe732141b
MD5 233021b6842fd760bdbe262e3ee7dc9a
BLAKE2b-256 0597fb21740ca6ad4aae4441e4c979a894074a6cbb88650a8467a4cfb7437a90

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