mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1.02k stars 158 forks source link

I don't know how to make CodeCarbon work in Colab #386

Closed alemolteni closed 1 month ago

alemolteni commented 1 year ago

Description

I can't open the dashboard using codecarbone. I managed to run an EmissionTracker(), but I have no idea how to access dashboard. I have read the documentation, but I can't really understand what do I have to do with the ".codecarbon.config" file in the project root.

What I Did

!codecarbon init --> I don't know what to do with the id
!!codecarbon monitor --> cell run forever and I can't run other cells
!carbonboard --filepath="emissions.csv" --port=3333 --> dashboard doesn't load
mdhanna commented 1 year ago

First run print(eval_js("google.colab.kernel.proxyPort(3333)")) to get a proxy to the server where the dashboard is running. Then run !carbonboard --filepath="emissions.csv" --port=3333 but instead of clicking on the output from this cell, click on the proxy link from the first command.

benoit-cty commented 1 year ago

Thanks @mdhanna I don't know that it could be run on collab !

Please note that to monitor a notebook it could be simple to put:

from codecarbon import EmissionsTracker
tracker = EmissionsTracker()
tracker.start()

In a cell at the top of the notebook, and just tracker.stop() in the last cell.

See https://mlco2.github.io/codecarbon/usage.html#explicit-object

SaboniAmine commented 1 month ago

Closing this as question have been answered.