Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

ml-logger

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 "mllogger[all]"

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

Install from source

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

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

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

Documentation

https://shagunsodhani.github.io/ml-logger

Use

  • Make a logbook_config:

    from ml_logger import logbook as ml_logbook
    logbook_config = ml_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 = ml_logbook.LogBook(config = logbook_config)
    
  • Use the logbook instance:

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

    The API for write_metric_log 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
  • Tests can be run locally using nox

Acknowledgements

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

Release files for mllogger 0.6rc2

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

Source distribution (sdist)

Source distribution for mllogger 0.6rc2
File Size Uploaded
mllogger-0.6rc2.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mllogger 0.6rc2
File Interpreter ABI Platform
mllogger-0.6rc2-py3-none-any.whl Python 3 none any Details

Total release size: 43.6 kB

Release files / mllogger-0.6rc2.tar.gz

Download URL mllogger-0.6rc2.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f78ee05bfa882062af151e968f40e2d77c5cf2484f0f0d3f991a8e77fe4ef954
BLAKE2b-256 checksum
How to use checksums
48a8aab72e05d28edeacf6feebe2c227a7566c9d8f51f87415c16d6f198779fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

Release files / mllogger-0.6rc2-py3-none-any.whl

Download URL mllogger-0.6rc2-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
103b9af973e500b59ad0446774068eea28f3217e8b64e4f5374e78e16a13476e
BLAKE2b-256 checksum
How to use checksums
05fdac6b7a6155b6f9acc4772c1e5c93baa157165c3647e93956de7b5b1bf914
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
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