Skip to content

Measure impact locally

Submissions are measured on our servers, but you can compare ideas much faster on your own machine with CodeCarbon. It estimates the energy used by your CPU, GPU and RAM.

uv add --dev codecarbon
from codecarbon import EmissionsTracker

with EmissionsTracker() as tracker:
    run_inference()  # the code you want to measure

print(f"{tracker.final_emissions:.6f} kg CO2eq")

A row is also added to emissions.csv after each run. The .gitignore written by the CLI already ignores it.

Use it to compare, not to predict your score

Local numbers depend on your hardware and on everything else running on your machine. Use them to compare two approaches side by side. Close other heavy programs and run each measurement a few times.

Ideas that usually help

  • Start from a small baseline and only scale up if accuracy really improves.
  • Try smaller or distilled models, quantization and pruning.
  • Batch your predictions and avoid repeated loading or preprocessing.
  • Keep your dependencies light, since installing and importing them takes time too.