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

EmissionTracker not updating .csv file, but create new #364

Closed NicolaCST closed 1 year ago

NicolaCST commented 1 year ago

Description

Hi all, I was trying to update my .csv emission file with some results. However it keeps creating new "*.bak" file, even tho i've setted:

tracker = codecarbon.EmissionsTracker(output_dir = "/content/emissions/", output_file = "test.csv", tracking_mode = "process", log_level = "debug", on_csv_write = "append")

Every time i try to run this cell, a new file named "test.csv_n.bak" (where n is the number of times i runned the cell) is created

What I Did

tracker = codecarbon.EmissionsTracker(output_dir = EMISSION_PATH+"/", 
                                    output_file = "test.csv",
                                    tracking_mode = "process",
                                    log_level = "debug",
                                    on_csv_write = "append")

tracker.start()

train_val_mnist = fit_and_eval(snet_mnist, epochs, optimizer, criterion, mnist_nclasses,
                                                  train_dataload_mnist, val_dataload_mnist, device, 
                                                  T=5, validation_step=True, convolution=False, onehot=False)

emissions_mnist_snn: float = tracker.stop()
NicolaCST commented 1 year ago

Just remove the initialization of the tracker from the cell.

benoit-cty commented 1 year ago

Did you solved your problem by initializing EmissionsTracker just one time ?