Skip to main content

Reduce multiple TensorBoard runs to new event (or CSV) files

Project description

TensorBoard Reducer

Tests pre-commit.ci status PyPI This project supports Python 3.6+ License GitHub Repo Size

Compute reduced statistics (mean, std, min, max, median or any other numpy operation) of multiple TensorBoard runs matching a directory glob pattern. This can be used after training multiple identical models to reduce the noise in their loss/accuracy/error curves e.g. when trying to establish a statistically significant improvement in training performance.

Requires PyTorch and TensorBoard. No TensorFlow installation required.

Installation

pip install tensorboard-reducer

Usage

Example:

tb-reducer -i 'glob_pattern/of_dirs_to_reduce*' -o basename_of_output_dir -r mean,std,min,max

Mean of 3 TensorBoard logs

tb-reducer has the following flags:

  • -i/--indirs-glob (required): Glob pattern of the run directories to reduce.
  • -o/--outdir (required): Name of the directory to save the new reduced run data.
  • -r/--reduce-ops (required): Comma-separated names of numpy reduction ops (mean, std, min, max, ...). Default is mean. Each reduction is written to a separate outdir suffixed by its op name, e.g. if outdir='my-new-run, the mean reduction will be written to my-new-run-mean. Only exception is std which will create two outdirs named my-new-run-mean+std and my-new-run-mean-std.
  • -f/--format: Output format of reduced TensorBoard runs. One of tb-events for regular TensorBoard event files or csv. If csv, -o/--outdir must have .csv extension and all reduction ops will be written to a single CSV file rather than separate directories for each reduce op.
  • -w/--overwrite (optional): Whether to overwrite existing reduction directories.

Testing

This project uses pytest. To run the entire test suite:

python -m pytest

To run individual or groups of test files, pass pytest a path or glob pattern, respectively:

python -m pytest tests/test_cumulative.py
python -m pytest **/test_*_metrics.py

To run a single test, pass its name to the -k flag:

python -m pytest -k test_precision_recall_curve

Consult the pytest docs for more details.

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

tensorboard-reducer-0.1.2.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

tensorboard_reducer-0.1.2-py2.py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 2 Python 3

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