Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Energy measurements for model inference #45

Closed
LukasHedegaard opened this issue Feb 11, 2022 · 2 comments
Closed

Energy measurements for model inference #45

LukasHedegaard opened this issue Feb 11, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@LukasHedegaard
Copy link

Issue

In the current library version, the focus has been on tracking model training.
A similarly important use-case for energy tracking is for model inference to gauge cost to our climate and wallets in deployment.

While one can "hack" this behaviour by specifying one epoch, which only includes inference, e.g.:

tracker = tracker.CarbonTracker(epochs=1, verbose=print_details)
tracker.epoch_start()
model(sample)  # inference here
tracker.epoch_end()

the energy usage is too low to be visible in the prints.

Proposed updates

  1. Use higher precision for kWh print (or even give an option to print in Joules)
  2. Create a separate mode, e.g. tracker.inference_start and tracker.inference_end, or even just tracker.start and tracker.end
@lfwa
Copy link
Owner

lfwa commented Mar 9, 2022

Hi Lukas,

I agree with your suggestions!

Regarding 1: You should be able to increase the decimal precision by setting the argument decimal_precision when you instantiate the Carbontracker class. There is currently an open issue where this only affects stdout and not the log files (see #25). However, if the reported energy consumption is very low then the accuracy may not be very high. You should instead consider running inference for a longer period of time and then take an average.

If you would like to have the energy consumption printed in Joules instead the easiest option is likely to submit a pull request with the proposed changes (changes will likely be in tracker.py) or pull the repository, change it locally, and then install the package again from your local changes.

For 2: This is closely related to #34 and I completely agree. However, further enhancements to carbontracker will likely have to be community-driven at this point in time due to all of us authors having other ongoing projects. If any critical issues appear then I will try to fix it as soon as possible.

@lfwa lfwa added the enhancement New feature or request label Mar 9, 2022
@PedramBakh
Copy link
Collaborator

In Release v1.2.0 we've:

  • Increased the default decimal precision to 12 to align with kWh and gCO2/kWh units, which are standards in the energy sector. This enhancement ensures consistent reporting without affecting existing functionality.
  • Introduced the CarbonTracker CLI tool, making it simpler to integrate with model inference scripts or any other Python scripts you wish to monitor.

Given these updates, I'm closing this issue. If there are any further concerns or feedback related to this topic, please feel free to reopen or create a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants