Skip to main content

"Log as append-only source" logger

Project description

Log as append-only source package

Build Status

Logs as append-only source: write your ML training results in Python without having to worry about crashes. Loading is a breeze: the logs are native Python code. The package supports unstructured data. The data can easily be imported into Jupyter Notebooks or elsewhere.

Installation

To install using pip, use:

pip install blackhc.laaos

To run the tests, use:

python setup.py test

Append-only source logs

Storing training results as Python dictionaries or JSON files is problematic because the formats are not append-only, which means that you have to rewrite the file every time something changes. (Or you only write results at the end, which does not play well with interruptions or intermediate failures.)

Alternatively, we can simply write the operations that create a structure to a file in an append-only fashion. If the data structure itself is growing and not mutated, this only increases file-size by a constant factor.

The advantage of this library is that the file format is very simple: it's valid Python code.

The only requirement is that you only store primitive types, lists, sets, dicts and immutable types.

Custom wrappers can be added by registering TypeHandlers when creating a Store. See WeakEnumHandler and StrEnumHandler.

Example

from blackhc.laaos import create_file_store, safe_load_store
store = create_file_store('test', suffix='')

store['losses'] = []
losses = store['losses']

for i in range(1, 10):
    losses.append(1/i)

store.close()

The resulting file laaos/test.py contains valid Python code:

store = {}
store['losses']=[]
store['losses'].append(1.0)
store['losses'].append(0.5)
store['losses'].append(0.3333333333333333)
store['losses'].append(0.25)
store['losses'].append(0.2)
store['losses'].append(0.16666666666666666)
store['losses'].append(0.14285714285714285)
store['losses'].append(0.125)
store['losses'].append(0.1111111111111111)

It can be loaded either with:

form laaos.test import store

or with the more secure:

safe_load('laaos/test.py')

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

blackhc.laaos-1.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

blackhc.laaos-1.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file blackhc.laaos-1.1.0.tar.gz.

File metadata

  • Download URL: blackhc.laaos-1.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for blackhc.laaos-1.1.0.tar.gz
Algorithm Hash digest
SHA256 162c79505cef71d61b142858d3807b2e4a0ee997b0f1161e60995eab0079648c
MD5 aa83fe584c3d1933feca895f29b62be7
BLAKE2b-256 4942b18cd4e6c47d37815bced3b2c6e3a9a611668e56010f24aa8a7b04addcd8

See more details on using hashes here.

File details

Details for the file blackhc.laaos-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: blackhc.laaos-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for blackhc.laaos-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39f622897a3f719932abdcd8a0b5b6f109c5479c19e1c8e50a9bc66bdbd8d98e
MD5 d23d61cd51e454e21fb86b6acb09b797
BLAKE2b-256 42df6954e33da8c7f0666eac9549fef235048ca82e6d246a0726475b3bbaad6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page