mlco2 / mlco2/codecarbon

Feature Request: Add Step-Specific Emissions Data

Open
#799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.9k
Forks
323
Avg merge
1d 12h
Merged PRs (30d)
12

Description

Hi,

I hope this message finds you well.

First, I want to express my gratitude for the fantastic open-source library you’ve developed. It has been incredibly helpful in my projects.

While using the library, I noticed that there isn’t currently a feature to retrieve emissions data at specific steps for logging purposes, such as with Weights & Biases (wandb). To address this, I’ve implemented a simple solution that I believe could benefit the community.

Here’s a brief overview of the code I developed:

class BaseEmissionsTracker(ABC):
    #~~code~~
    
    def get_data(self) -> Union[EmissionsData,EmissionsData]:
        self._measure_power_and_energy()
        emissions_data = self._prepare_emissions_data() 
        emissions_data_delta = self._compute_emissions_delta(emissions_data)
        return emissions_data, emissions_data_delta
    
    #~~code~~

I would love to share this enhancement with the community and would appreciate your consideration in integrating it into the library. Please let me know if you would like me to submit a pull request or if there are any specific guidelines I should follow.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the BaseEmissionsTracker.get_data entry point shown in the issue and review how emissions data is measured, prepared, and returned. Determine how step-specific values should be exposed for logging integrations such as wandb; the work is done when callers can retrieve and log emissions data for individual steps without disrupting existing tracking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.