Logging Utility for ML Experiments
Project description
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 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
- Tests can be run locally using
nox
Acknowledgements
- Config for
circleci
,pre-commit
,mypy
etc are borrowed/modified from Hydra
Project details
Release history Release notifications | RSS feed
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 mllogger-0.5.tar.gz
.
File metadata
- Download URL: mllogger-0.5.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60fa472a7aeb121ea8c516bfd1235157e042877dc92acaeee648e5f81987d802 |
|
MD5 | 1f3508a623595ad0ff0fb129f98454c6 |
|
BLAKE2b-256 | c89e8c044649d3c659838f43b96b1f015c117ad51075995a9447fe5bc6f873e9 |
File details
Details for the file mllogger-0.5-py3-none-any.whl
.
File metadata
- Download URL: mllogger-0.5-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200119 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a77daa9afcd95cad80112c0fe33ce9e4502addfbfa6e61f6ba2de94eae4b2b3a |
|
MD5 | 8291fd841e3982a1f9493efa06b18cc9 |
|
BLAKE2b-256 | 55b62a4d72b5cd6c10ddea5f1557467e2cfb5848cffd7e8e3271acf6c62d559e |