Skip to main content

A lightweight package to measure the ecological and financial effect of training and evaluation of pytorch projects.

Project description

EcoTorch

CI codecov PyPI version Python versions License: LGPL v3

EcoTorch is a lightweight, plug-and-play Python package designed to measure and track the ecological and financial impact of training and evaluating PyTorch models.

Key Features

  • Seamless Integration: Track training and evaluation sessions using simple Python context managers.
  • Hardware Monitoring: Support for NVIDIA GPUs (via NVML) and Apple Silicon (via custom SMC monitoring).
  • Global Impact Tracking: Automatically detects location and uses up-to-date carbon intensity and electricity price data.
  • Financial Cost Reporting: Estimates the financial cost of your PyTorch workloads in real-time.
  • Efficiency Scoring: Provides a specialized score that balances model improvement with environmental cost.

Installation

Install EcoTorch via pip:

pip install ecotorch

Quick Start

You don't need to rewrite your existing code. Just wrap your training or evaluation loops with TrainTracker or EvalTracker.

import torch
from ecotorch import TrainTracker, EvalTracker

model = ...
train_loader = ...
epochs = 10

# Track Training
with TrainTracker(model=model, epochs=epochs, train_dataloader=train_loader) as tracker:
    # Your training loop here
    initial_loss = 2.5
    final_loss = 0.5

# Calculate efficiency score
score = tracker.calculate_efficiency_score(initial_loss=initial_loss, final_loss=final_loss)
print(f"Training Efficiency Score: {score}")

Documentation

For full documentation, including a getting started guide, API reference, and detailed methodology, please see the docs/ directory:

Contributing

We welcome contributions! Please see our Contributing Guidelines and Code of Conduct.

License

EcoTorch is released under the GNU LGPLv3 License.

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

ecotorch-0.2.6.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

File details

Details for the file ecotorch-0.2.6.tar.gz.

File metadata

  • Download URL: ecotorch-0.2.6.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for ecotorch-0.2.6.tar.gz
Algorithm Hash digest
SHA256 059c50c25298c9ba06e686650c803b0fa66121bbbd984a81a6f9ca02617f6ca5
MD5 77a92258230c08c04c5bf27297f3f79e
BLAKE2b-256 8b6ecf9f2656b7ced5bcf08ddeb5c36ec89e71c497d8fb1f33564b107f11cbc7

See more details on using hashes here.

File details

Details for the file ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 dd9a8b20db39289f9e12941e568ae9289c0d50f7fd4f2bd78e10fd2bc50d3064
MD5 6add80b37d01b2de089bea04c129af8e
BLAKE2b-256 4f4f3beb4ad5e20eccd1d8d82b7c5d14f659b6b5a27860dc5efa346aa3f34b2c

See more details on using hashes here.

Supported by

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