tsenst / lightning-experiments-logger

A SageMaker Experiment logger class for PyTorch Lightning
https://medium.com/idealo-tech-blog/experiment-tracking-with-aws-sagemaker-and-pytorch-lightning-68b22fd4deee
Other
6 stars 0 forks source link
deep-learning experiment-tracking logger machine-learning mlops python pytorch pytorch-lightning

Python Version PyPI Version Documentation

SagemakerExperimentsLogger

SagemakerExperimentsLogger provides a simple way to log experimental data such as hyperparameter settings and evaluation metrics via AWS SageMaker Experiments API. It can be easily integration into the concept of Pytorch Lightning Trainer class.

For detailed documentation, including the API reference, see Read the Docs

Installation

You can install the latest (nightly) version with pip using ssh with

pip install sagemaker-experiments-logger

Quickstart

The SageMaker Experiments logger can be easily applied by setup an own run context:

from pytorch_lightning import Trainer
from sagemaker.experiments.run import Run
from experiments_addon.logger import SagemakerExperimentsLogger

with Run(experiment_name="testExperiment", run_name="testRun1"):
    logger = SagemakerExperimentsLogger()
    trainer = Trainer(
        logger=logger,
        ...
    )
    ...

or by using an existing run context. For example in a SageMaker Training Step

from pytorch_lightning import Trainer
from experiments_addon.logger import SagemakerExperimentsLogger

logger = SagemakerExperimentsLogger(experiment_name="TestExp", run_name="TestRun")
trainer = Trainer(
logger=logger,
    ...
)
...

Usage

Try Tutorial Notebook to learn more about the usage of the SagemakerExperimentsLogger class.

It is also worth to read the blog post: Experiment Tracking With AWS SageMaker and PyTorch Lightning

Contributing

I welcome all contributions!

To file a bug or request a feature, please file a GitHub issue. Pull requests are welcome.

License

This library is licensed under the Apache 2.0 License.