Skip to main content

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.

Metadata

Release files for ecotorch 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecotorch 0.2.6
File Size Uploaded
ecotorch-0.2.6.tar.gz 2.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ecotorch 0.2.6
File Interpreter ABI Platform
ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details

Total release size: 5.2 MB

Release files / ecotorch-0.2.6.tar.gz

Download URL ecotorch-0.2.6.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
059c50c25298c9ba06e686650c803b0fa66121bbbd984a81a6f9ca02617f6ca5
BLAKE2b-256 checksum
How to use checksums
8b6ecf9f2656b7ced5bcf08ddeb5c36ec89e71c497d8fb1f33564b107f11cbc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release files / ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl

Download URL ecotorch-0.2.6-cp313-cp313-macosx_26_0_arm64.whl
Size 2.7 MB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
dd9a8b20db39289f9e12941e568ae9289c0d50f7fd4f2bd78e10fd2bc50d3064
BLAKE2b-256 checksum
How to use checksums
4f4f3beb4ad5e20eccd1d8d82b7c5d14f659b6b5a27860dc5efa346aa3f34b2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page