Skip to main content

emission tracking library

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

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.0.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

eco2ai-0.1.0-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eco2ai-0.1.0.tar.gz
  • Upload date:
  • Size: 35.5 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.0.tar.gz
Algorithm Hash digest
SHA256 a1335ad80109e9625648dc8c1f8bb9709b96dc7e90b1381d579d8114e82429c2
MD5 e01eff7c8786cf2343da0304795fc453
BLAKE2b-256 caf7fd44ac114ab489eddbb79baa1f86ecc3b6a0ea46a8d5334b10ca05a9aa21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eco2ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57b6cd5e820dae0d0785ab19ba1b14f5b31c60619a70af7be9a346bf53244cd3
MD5 657e9dda630f90661c7afa231456346b
BLAKE2b-256 75091e6217b4b05b848839ba0eb1d7e4a911d795915664050842d8f40f638d08

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