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: MIT

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 Carbon Intensity: Automatically detects location and uses up-to-date carbon intensity data.
  • 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 MIT 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.5.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.5-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.5.tar.gz.

File metadata

  • Download URL: ecotorch-0.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 b0208c4dc0fb99c8afd064df8aef6e0c5dc0a164424991fe0a173b573a9d1430
MD5 2a28e7704a827b984a8b8b9030ae4b54
BLAKE2b-256 d27bb74e7cf2dc1208896394b6f9e9177eccde0281a3c986bac2428bd77d318c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ecotorch-0.2.5-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 198cad577b79486292d83278ac7f05bfed3360420a407ddaf6df39f570986065
MD5 ffbdb94e02c904bf6ee4d482a3f920c6
BLAKE2b-256 241b6c23b1bdfa60bc98c757739be4b2876b185e5b022e4a8883aca1142e06fb

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