PyTorch Training Cost & Carbon Estimator for Crusoe Cloud
Project description
⚡ crusoe-estimator
PyTorch Training Cost & Carbon Estimator for Crusoe Cloud
Benchmark your PyTorch training loop locally on a small sample, then get instant estimates for:
- ⏱️ Training time on every Crusoe Cloud GPU (A100, H100, H200, MI300X)
- 💰 Cost on Crusoe Cloud
- 🌍 CO₂ savings — your local emissions vs Crusoe's near-zero carbon footprint
Installation
pip install crusoe-estimator
Or with PyTorch (if not already installed):
pip install "crusoe-estimator[torch]"
Quick Start
Pattern 1: Training Loop Wrapper (Recommended)
from crusoe_estimator import CrusoeEstimator
estimator = CrusoeEstimator(total_epochs=100, location="HR")
for epoch in estimator.epochs(sample=3):
# Your normal training code — runs only 3 epochs
for batch_x, batch_y in train_loader:
optimizer.zero_grad()
output = model(batch_x)
loss = criterion(output, batch_y)
loss.backward()
optimizer.step()
# Generate a beautiful HTML report
estimator.generate_report("training_report.html")
# Or print a text summary
print(estimator.summary())
Pattern 2: Decorator
estimator = CrusoeEstimator(total_epochs=100, location="DE")
@estimator.watch(sample_epochs=3)
def train_epoch(model, dataloader, optimizer, criterion):
for x, y in dataloader:
optimizer.zero_grad()
loss = criterion(model(x), y)
loss.backward()
optimizer.step()
# Calling the decorated function runs 3 epochs and benchmarks
train_epoch(model, train_loader, optimizer, criterion)
estimator.generate_report("report.html")
Pattern 3: Context Manager
estimator = CrusoeEstimator(total_epochs=100, sample_epochs=5, location="US")
with estimator.track():
for epoch in range(5):
train_one_epoch(model, train_loader, optimizer, criterion)
estimator.generate_report("report.html")
Pattern 4: Function Wrapper
estimator = CrusoeEstimator(total_epochs=100, location="HR")
result = estimator.estimate(
train_fn=lambda: train_one_epoch(model, loader, optimizer, criterion),
sample_epochs=3,
)
estimator.generate_report("report.html")
Dataset Scaling
If you benchmark with a smaller dataset:
estimator = CrusoeEstimator(
total_epochs=100,
total_dataset_size=50000,
sample_dataset_size=5000, # Using 10% of data
location="HR",
)
Supported GPUs
Crusoe Cloud
| GPU | FP16 TFLOPS | Memory | Price/hr |
|---|---|---|---|
| A100 80GB | 312 | 80 GB | $1.47 |
| H100 SXM | 989 | 80 GB | $2.25 |
| H200 SXM | 989 | 141 GB | $3.25 |
| MI300X | 1307 | 192 GB | $2.49 |
Local GPU Detection
Automatically detects 50+ GPUs:
- NVIDIA: RTX 20/30/40 series, A100, H100, V100, T4
- AMD: MI300X, MI250X
- Apple Silicon: M1–M4 (all variants)
How It Works
- Detect local GPU and its specifications (FLOPS, memory, TDP)
- Benchmark your training loop for N sample epochs
- Extrapolate total training time using average epoch time
- Scale to Crusoe GPUs using FLOPS ratio (70% compute + 30% memory bandwidth weighting)
- Calculate cost based on Crusoe pricing
- Estimate CO₂ using regional carbon intensity (local) vs near-zero (Crusoe)
- Generate an HTML report with tables, charts, and recommendations
Carbon Intensity
Uses real-world carbon intensity data (kg CO₂/kWh):
- 🇭🇷 Croatia: 0.170
- 🇩🇪 Germany: 0.340
- 🇫🇷 France: 0.056
- 🇺🇸 USA: 0.390
- 🇨🇳 China: 0.560
- ☁️ Crusoe: ≈ 0.000 (renewable energy)
API Reference
CrusoeEstimator
Main class. Constructor parameters:
total_epochs— how many epochs the full training would runsample_epochs— how many epochs to actually benchmark (default: 3)total_dataset_size— full dataset size (optional, for scaling)sample_dataset_size— dataset size used in sample (optional)location— country code for CO₂ calculation (e.g., "HR", "US", "DE")power_watts_override— override auto-detected GPU power draw
Reports
estimator.generate_report("report.html")— HTML reportestimator.summary()— text summary
Built with 💚 at HackEurope 2026 • Powered by Crusoe Cloud
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crusoe_estimator-0.1.2.tar.gz.
File metadata
- Download URL: crusoe_estimator-0.1.2.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16c434240e5a8ac4d8d6f60c5dc58cbd3c6f1d1d36e306782baaa7af373ac9f4
|
|
| MD5 |
dce0cd7829153a4186c58076fe4f5846
|
|
| BLAKE2b-256 |
4cd4502a4a886b7778cc6ba8f53b5696919a224673715507de27aeaf60003a8a
|
File details
Details for the file crusoe_estimator-0.1.2-py3-none-any.whl.
File metadata
- Download URL: crusoe_estimator-0.1.2-py3-none-any.whl
- Upload date:
- Size: 41.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc00bb226e0ac33330b2664ce40504c03d2acba8649d1b8a329142b9d065acaf
|
|
| MD5 |
3ee08a7d4674536321dd65f75d30b9cf
|
|
| BLAKE2b-256 |
4dd65d490ef1352f06d8f527ffc73363989e1798a88a265d3ee42c0b3f35b4b9
|