Skip to main content

torch_logger 🔥

PyPI - Python Version

This minimalist package serves to log best values of performance metrics during the training of PyTorch models. The idea is to automatically log the best value for each tracked metric such that it can be directly analyzed downstream (e.g. when using wandb) without the need to post-process the raw logged values to identify the overall best values and corresponding steps.

Usage:

>>> from torch_logger import BestValueLogger
>>> bv_log = BestValueLogger(
        {'val_loss': False, 'val_roc': True} # <-- provide flag if larger is better
    )

Log values after each eval step:

    ... 
>>> bv_log([val_loss, val_roc], step=0)
    ... 
>>> bv_log([val_loss, val_roc], step=1)
    ...  
>>> bv_log([val_loss, val_roc], step=2)

Inspect the logger:

>>> bv_log

::BestValueLogger::
Tracking the best values of the following metrics:
{
    "val_loss": false,
    "val_roc": true
}
(key: metric, value: bool if larger is better)
Best values and steps:
{
    "best_val_loss_value": 0.05,
    "best_val_loss_step": 2,
    "best_val_roc_value": 0.8,
    "best_val_roc_step": 1
}

Update your experiment logger (e.g. wandb) with best_values at the end of training

>>> wandb.log( bv_log.best_values ) 

Logging values without steps

In case you only wish to track values but not the corresponding steps, run:

>>> bvl = BestValueLogger({'val_loss': False, 'val_roc':True}, log_step=False)

Populate logger with metrics:

>>> bvl([0.2,0.8], step=1)
>>> bvl([0.2,0.9], step=2)

Inspect:

>>> bvl
::BestValueLogger::
Tracking the best values of the following metrics:
{
    "val_loss": false,
    "val_roc": true
}
(key: metric, value: bool if larger is better)
Best values:
{
    "best_val_loss_value": 0.2,
    "best_val_roc_value": 0.9
}

Metadata

Release files for torch-logger 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torch-logger 0.1.1
File Size Uploaded Provenance
torch_logger-0.1.1.tar.gz 2.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for torch-logger 0.1.1
File Interpreter ABI Platform
torch_logger-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / torch_logger-0.1.1.tar.gz

Download URL torch_logger-0.1.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
27688fd98ec07a5d7dddc3ef4bb2040fdf3ef2524d1ddc39b9c038169f1bffc8
BLAKE2b-256 checksum
How to use checksums
fb4f6e4e6c34d953c490d5b695a3cf81aaafdf5b410f4d8bc2982a2f2d915427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.3 Darwin/20.6.0

Release files / torch_logger-0.1.1-py3-none-any.whl

Download URL torch_logger-0.1.1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b703f71fd7f8f08d79c3b3df3e29a2687131184e592fbd1a93c73500579971e
BLAKE2b-256 checksum
How to use checksums
f72c1131a25c7eabd0151d44a548ab03560599a58ac8ce562689aabbe2cb7155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.3 Darwin/20.6.0

Security for torch-logger 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page