Skip to main content

emission tracking library, co2 coefficient corrected

Project description

Eco2AI

Eco2AI - is a python library which calculates power consumption and CO2 emission during running code. Emission information is written to file. Every single run of tracker creates line in this file with following items:

  • project_name
  • experiment_description
  • start_time
  • duration(s)
  • power_consumption(kWTh)
  • CO2_emissions(kg)
  • CPU_name
  • GPU_name
  • OS
  • country

Installation

To install eco2ai library run next command:

pip install eco2ai

Use examples

eco2ai's interface is quite simple. Here is a the most straightforward usage example:

import eco2ai

tracker = eco2ai.Tracker(project_name="YourProjectName", experiment_description="training the <your model> model")

tracker.start()

<your gpu &(or) cpu calculations>

tracker.stop()

eco2ai also supports decorators. Once decorated function executed, emissions info will be written to the file. See example below:

from eco2ai import track

@track
def train_func(model, dataset, optimizer, epochs):
    ...

train_func(your_model, your_dataset, your_optimizer, your_epochs)

For your convenience every time you initilize a Tracker object with your custom parameters, this settings will be saved until library is uninstalled, and then every new tracker will be created with your custom settings(if you will create new tracker with new parameters, then they will be saved instead of old ones). For example:

import eco2ai

tracker = eco2ai.Tracker(
    project_name="YourProjectName", 
    experiment_description="training <your model> model",
    file_name="emission.csv"
    )

tracker.start()
<your gpu &(or) cpu calculations>
tracker.stop()

...

# now, we want to create a new tracker for new calculations
tracker = eco2ai.Tracker()
# now, it's equivelent to:
# tracker = eco2ai.Tracker(
#     project_name="YourProjectName", 
#     experiment_description="training the <your model> model",
#     file_name="emission.csv"
# )
tracker.start()
<your gpu &(or) cpu calculations>
tracker.stop()

You can also set parameters using set_params() function, like in the example below:

from eco2ai import set_params, Tracker

set_params(
    project_name="My_default_project_name",
    experiment_description="We trained...",
    file_name="my_emission_file.csv"
)

tracker = Tracker()
# now, it's equivelent to:
# tracker = Tracker(
#     project_name="My_default_project_name",
#     experiment_description="We trained...",
#     file_name="my_emission_file.csv"
# )
tracker.start()
<your code>
tracker.stop()

Important note

According to climate transparency report for each kilowatt hour of electricity generated in Russia in 2020, an average of 310 g of CO2 was emitted. This constant is used in CO2 estimation by default.

In order to calculate gpu & cpu power consumption correctly you should create the 'Tracker' before any gpu or cpu usage

For every new calculation create a new “Tracker.”

Feedback

If you had some problems while working with our tracker, please, give us a feedback comments in document

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eco2ai-0.1.1.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

eco2ai-0.1.1-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file eco2ai-0.1.1.tar.gz.

File metadata

  • Download URL: eco2ai-0.1.1.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.2 Windows/10

File hashes

Hashes for eco2ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4d9d2b7d733299e1b951ed68d8fa90fb2da4c4dd6a88a83f1ffca78847699158
MD5 8ffa01255dbfe2e6468f6fecf1b93e5b
BLAKE2b-256 51cc00e3f30044032a0b07c0fd19ec5924932f012d52f35acb65b9ed788058e0

See more details on using hashes here.

File details

Details for the file eco2ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: eco2ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.2 Windows/10

File hashes

Hashes for eco2ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7826b1156109b454d016e737d1148c629476c2aed7041e0994733525ad43afc7
MD5 07b919c04e26582c226a5b59ac599992
BLAKE2b-256 e8cec0a23e26c1e549936b2ae0eb10cbc7982c8eee07e2912f14f999ff73e9bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page