lfwa / carbontracker

Track and predict the energy consumption and carbon footprint of training deep learning models.
MIT License
374 stars 27 forks source link

Fix logging redudancy on multiple instances #73

Closed Snailed closed 2 months ago

Snailed commented 3 months ago

When making multiple trackers (or re-instantiating as common in Notebook-like environments), each instantiation of CarbonTracker causes logging to duplicate messages. This is due to logger.getLogging always returning the same logging instance when called with the same argument (singleton-like). This is fixed by having each instance of CarbonTracker have a unique logging_id, which makes each instance have their own logger.

This solves issue #70