An open-source Python package that estimates the electricity use and carbon emissions of your code while it runs, for measuring and reporting the footprint of training and running models.
| Website | https:// |
| Source code | https:// |
| Developed by | Mila, BCG GAMMA, Comet.ml, Haverford College, Code Carbon NGO (2020) |
| Type | Software library: Python package with command-line tool and dashboard |
| Lifecycle phase | Development, Deployment |
| FUTURE-AI | General recommendations, Traceability |
| For | AI developers, Researchers |
| Facilitation | No facilitator needed |
| Skills needed | Python |
| Cost | Free |
| Languages | English |
| Maturity | Established |
| Licence | MIT |
What it is¶
You wrap your code in a tracker (or run it through the command-line tool), and CodeCarbon measures or estimates the power drawn by the CPU, GPU and RAM. It then multiplies that energy by the carbon intensity of the electricity grid where the computation runs. Results are saved to a file and can be viewed in a local or online dashboard. It covers compute on hardware you run yourself; it does not account for disk, network or cooling, and it does not track calls to remote generative AI APIs.
In healthcare¶
Useful when a hospital or research group wants to report the environmental cost of training a clinical model, or to compare candidate models on emissions as well as accuracy.
Where to use it in The ELSA Way¶
Social and societal impact › Environmental impact: It measures the emissions of training and running your model, which you need if you plan to report environmental impact or compare energy-saving options such as smaller or distilled models.
References¶
Courty B, Schmidt V, Luccioni S, et al. mlco2/codecarbon (software). Zenodo; 2024. Benoit Courty et al. (2024)
Related tools¶
MLflow: An open-source platform that records what went into each model run and keeps a versioned registry of trained models, which lets you trace any deployed model back to its code, data and settings.
- Benoit Courty, Victor Schmidt, Goyal-Kamal, MarionCoutarel, Boris Feld, Jérémy Lecourt, LiamConnell, SabAmine, inimaz, supatomic, Mathilde Léval, Luis Blanche, Alexis Cruveiller, ouminasara, Franklin Zhao, Aditya Joshi, Alexis Bogroff, Amine Saboni, Hugues de Lavoreille, … MinervaBooks. (2024). mlco2/codecarbon: v2.4.1. Zenodo. 10.5281/ZENODO.11171501