Skip to content
drawnatorPublic

About

Python decorator to log artifacts with mlflow, wandb

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Atlogger

Python decorator to log artifacts with mlflow, wandb, rerun, tensorboard, etc...

Inspired by many talks with colleagues, frustrating nights and the python logging documentation I am attempting to develop a module to streamline the proper logging for model training and comparisons

How to use

export WANDB_API_KEY="wandb_key"
# main.py
from atlogger import logger, WandbHandler

logger.addHandler(
    WandbHandler(
      project="your_project_name",
      config={"config":True},
      level="DEBUG"
      )
  )
# lossFunc.py
from atlogger import log

@log
loss(x1,x2):
  return abs(x1 - x2)

@log("euclidean distance")
calc_distance(x1,x2):
  return sqrt(x1**2 - x2**2)

you can also use many other functionalities from pythons logging from the standard library as well as the many handlers we made to integrate seamlessly with diverse logging, profiling and code tracking libraries.

for more information head over to the documentation

Principles

Ideally this project will have the following principles:

  • Non-intrusive:
    • Snippets used for logging shouldn't be in the middle of the code. Anyone should be able to import code from one project to another without having to go through and delete or change lines throughout the functions.
  • Modular:
    • Added visualizations should be easy to add and be defined on their own and reused anywhere needed. enabling the user to use only the packages they already have without being locked behind a stack of dependencies
  • Explicit:
    • Logging shall not happen under the hood. you should be able to define and easily recognize when information is being logged but also have sensible defaults as not to loose important information that is constantly ignored (i.e. logging hardware load during ML models training)
  • Adaptable:
    • I want to be able to use this tool for logging diverse kinds of code and easily change between them:
      1. Ml training
      2. Compression algorithms
      3. async algorithms
      4. profiling algorithm duration
      5. reinforcement learning / robotics

Known bugs

  • running logger inside jupyter notebook ony works for one cell
  • config from file is not logging with proper log levels
  • wandb handler might not be filtering by log level

Current Goals

  • Add a basic implementation of mlflow, rerun, profiling
  • Only uses packages you have installed
  • Enable choice of what happens if logging fail: break, or ignore
  • Continue experiments
  • Log artifacts like images or models
  • Pass custom logger and custom formatter per call

About

Python decorator to log artifacts with mlflow, wandb

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages