Logging Utility for ML Experiments
Project description
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
:from xplogger import logbook logbook_config = 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 = 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 calledstep
. If yourlog
already captures thestep
but as a different key (sayepoch
), you can pass thewandb_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 calledstep
. If yourlog
already captures thestep
but as a different key (sayepoch
), you can pass themlflow_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 calledmain_tag
ortag
which acts as the data Identifier and another key calledglobal_step
. These keys are described here. If yourlog
already captures these values but as different key (saymode
formain_tag
andepoch
forglobal_step
), you can pass thetensorboard_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
Built Distribution
File details
Details for the file xplogger-0.7.tar.gz
.
File metadata
- Download URL: xplogger-0.7.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d35ce75e12415cae22f69496871861fc55402bc699ed6955479ace5afc288150 |
|
MD5 | e113188d0ba650fc81a104fd1fdb7a27 |
|
BLAKE2b-256 | 52a1c7f2d5937d942320279f7d6052b7fa59c99ee86eafd6d2bdfe11fbfdb806 |
File details
Details for the file xplogger-0.7-py3-none-any.whl
.
File metadata
- Download URL: xplogger-0.7-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0.post20210108 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5e7578dbb0d740eb3639933d262a24abd579c74ccadcac964177297520b78a7 |
|
MD5 | ffec5d959b082a67f9bbcee8626520e3 |
|
BLAKE2b-256 | ab754c9d0b974d4e4c62a4a55f64105a7bd03040f337b4620163931035f9426c |