Skip to main content

Logging Utility for ML Experiments

Project description

CircleCI PyPI - License PyPI - Python Version Code style: black DOI

xplogger

Logging utility for ML experiments

Why

People use different tools for logging experimental results - Tensorboard, Wandb etc to name a few. Working with different collaborators, I will have to switch my logging tool with each new project. So I made this simple tool that provides a common interface to logging results to different loggers.

Installation

  • pip install "xplogger[all]"

If you want to use only the filesystem logger, use pip install "xplogger"

Install from source

  • git clone git@github.com:shagunsodhani/xplogger.git
  • cd xplogger
  • pip install ".[all]"

Alternatively, pip install "git+https://git@github.com/shagunsodhani/xplogger.git@master#egg=xplogger[all]"

If you want to use only the filesystem logger, use pip install . or pip install "git+https://git@github.com/shagunsodhani/xplogger.git@master#egg=xplogger".

Documentation

https://shagunsodhani.github.io/xplogger

Use

  • Make a logbook_config:

    import xplogger.logbook
    logbook_config = xplogger.logbook.make_config(
        logger_dir = <path to write logs>,
        wandb_config = <wandb config or None>,
        tensorboard_config = <tensorboard config or None>,
        mlflow_config = <mlflow config or None>)
    

    The API for make_config can be accessed here.

  • Make a LogBook instance:

    logbook = xplogger.logbook.LogBook(config = logbook_config)
    
  • Use the logbook instance:

    log = {
        "epoch": 1,
        "loss": 0.1,
        "accuracy": 0.2
    }
    logbook.write_metric(log)
    

    The API for write_metric can be accessed here.

Note

  • If you are writing to wandb, the log must have a key called step. If your log already captures the step but as a different key (say epoch), you can pass the wandb_key_map argument (set as {epoch: step}). For more details, refer the documentation here.

  • If you are writing to mlflow, the log must have a key called step. If your log already captures the step but as a different key (say epoch), you can pass the mlflow_key_map argument (set as {epoch: step}). For more details, refer the documentation here.

  • If you are writing to tensorboard, the log must have a key called main_tag or tag which acts as the data Identifier and another key called global_step. These keys are described here. If your log already captures these values but as different key (say mode for main_tag and epoch for global_step), you can pass the tensorboard_key_map argument (set as {mode: main_tag, epoch: global_step}). For more details, refer the documentation here.

Dev Setup

  • pip install -e ".[dev]"
  • Install pre-commit hooks pre-commit install
  • The code is linted using:
    • black
    • flake8
    • mypy
    • isort
  • Tests can be run locally using nox

Acknowledgements

  • Config for circleci, pre-commit, mypy etc are borrowed/modified from Hydra

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

xplogger-0.11.0.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

xplogger-0.11.0-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file xplogger-0.11.0.tar.gz.

File metadata

  • Download URL: xplogger-0.11.0.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for xplogger-0.11.0.tar.gz
Algorithm Hash digest
SHA256 89547bfabf3f2136c35f85c4907c88f826c1499ced03ebf1896f0a5586afe918
MD5 1a6b6ecc665b58c0f7334793eeee1932
BLAKE2b-256 1c7339b505fc952c4b2e72bdce530f21772e8fbbfb6abeefd7a7e77eab8303b9

See more details on using hashes here.

File details

Details for the file xplogger-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: xplogger-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 51.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for xplogger-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de2f18e4181bbf07090228e211f0266122d030cbed746e7c79be5b8b0255b314
MD5 39b335081d597b9310d8637f8c1c46c1
BLAKE2b-256 ce9aaac597254db9f195a0ed4d5422051d2c554e95f14c5c4224d880ab1349b9

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