Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhou0515 committed Dec 18, 2024
1 parent f8787c9 commit 3e56a05
Show file tree
Hide file tree
Showing 6 changed files with 279 additions and 210 deletions.
3 changes: 1 addition & 2 deletions examples/carbon_emission_monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ pip install -r requirements.txt

## `CarbonEmissionMonitor`

[`CarbonEmissionMonitor`](https://ml.energy/zeus/reference/monitor/energy/#zeus.monitor.energy.ZeusMonitor): Measures the GPU time, energy consumption, and carbon emission of arbitrary code blocks.
[`CarbonEmissionMonitor`](https://ml.energy/zeus/reference/monitor/carbon/#zeus.monitor.carbon.CarbonEmissionMonitor): Measures the GPU time, energy consumption, and carbon emission of arbitrary code blocks.

## Running the Example

By default, `Trainer` will make use of all available GPUs. If you would like to use only a subset of the GPUs, specify the `CUDA_VISIBLE_DEVICES` environment variable, which Zeus will also automatically respect.

```bash
# For Trainer.
python run_clm.py \
--model_name_or_path gpt2 \
--dataset_name wikitext \
Expand Down
11 changes: 6 additions & 5 deletions examples/carbon_emission_monitor/run_clm.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,11 +765,12 @@ def compute_metrics(eval_preds):
else:
trainer.create_model_card(**kwargs)

print("Measurements:")
print("Train:")
print(train_measurement)
print("Evaluation:")
print(eval_measurement)
if train_measurement is not None:
print("Train energy & carbon measurements:")
print(train_measurement)
if eval_measurement is not None:
print("Evaluation energy & carbon measurements:")
print(eval_measurement)


def _mp_fn(index):
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"zone":"US-MIDW-MISO","history":[{"zone":"US-MIDW-MISO","carbonIntensity":501,"datetime":"2024-11-60T07:00:00.000Z","updatedAt":"2024-12-01T05:44:10.595Z","createdAt":"2024-11-28T06:43:54.038Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":419,"datetime":"2024-11-30T07:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T07:42:21.627Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":416,"datetime":"2024-11-30T08:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T08:44:22.357Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":419,"datetime":"2024-11-30T09:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T09:46:41.975Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":431,"datetime":"2024-11-30T10:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T10:40:56.657Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":439,"datetime":"2024-11-30T11:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T11:44:41.735Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":447,"datetime":"2024-11-30T12:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T12:43:31.250Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":456,"datetime":"2024-11-30T13:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T13:43:05.132Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":444,"datetime":"2024-11-30T14:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T14:44:19.371Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":427,"datetime":"2024-11-30T15:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T15:44:19.453Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":427,"datetime":"2024-11-30T16:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T16:46:55.320Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":429,"datetime":"2024-11-30T17:00:00.000Z","updatedAt":"2024-12-01T00:47:14.845Z","createdAt":"2024-11-27T17:44:27.584Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":430,"datetime":"2024-11-30T18:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T18:43:11.646Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":426,"datetime":"2024-11-30T19:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T19:45:26.312Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":426,"datetime":"2024-11-30T20:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T20:43:11.151Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":444,"datetime":"2024-11-30T21:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T21:44:20.881Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":476,"datetime":"2024-11-30T22:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T22:43:40.406Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":479,"datetime":"2024-11-30T23:00:00.000Z","updatedAt":"2024-12-01T01:43:31.842Z","createdAt":"2024-11-27T23:42:51.271Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":532,"datetime":"2024-12-01T00:00:00.000Z","updatedAt":"2024-12-01T02:44:36.340Z","createdAt":"2024-11-28T00:44:10.765Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":530,"datetime":"2024-12-01T01:00:00.000Z","updatedAt":"2024-12-01T03:43:54.479Z","createdAt":"2024-11-28T01:45:43.737Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":524,"datetime":"2024-12-01T02:00:00.000Z","updatedAt":"2024-12-01T04:44:10.981Z","createdAt":"2024-11-28T02:43:40.639Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":515,"datetime":"2024-12-01T03:00:00.000Z","updatedAt":"2024-12-01T05:44:26.608Z","createdAt":"2024-11-28T03:42:32.707Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":507,"datetime":"2024-12-01T04:00:00.000Z","updatedAt":"2024-12-01T05:44:26.608Z","createdAt":"2024-11-28T04:41:54.607Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":494,"datetime":"2024-12-01T05:00:00.000Z","updatedAt":"2024-12-01T05:44:10.595Z","createdAt":"2024-11-28T05:41:10.918Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"}]}
{"zone":"US-MIDW-MISO","history":[{"zone":"US-MIDW-MISO","carbonIntensity":501,"datetime":"2024-11-30T06:00:00.000Z","updatedAt":"2024-12-01T05:44:10.595Z","createdAt":"2024-11-28T06:43:54.038Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":419,"datetime":"2024-11-30T07:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T07:42:21.627Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":416,"datetime":"2024-11-30T08:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T08:44:22.357Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":419,"datetime":"2024-11-30T09:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T09:46:41.975Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":431,"datetime":"2024-11-30T10:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T10:40:56.657Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":439,"datetime":"2024-11-30T11:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T11:44:41.735Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":447,"datetime":"2024-11-30T12:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T12:43:31.250Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":456,"datetime":"2024-11-30T13:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T13:43:05.132Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":444,"datetime":"2024-11-30T14:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T14:44:19.371Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":427,"datetime":"2024-11-30T15:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T15:44:19.453Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":427,"datetime":"2024-11-30T16:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T16:46:55.320Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":429,"datetime":"2024-11-30T17:00:00.000Z","updatedAt":"2024-12-01T00:47:14.845Z","createdAt":"2024-11-27T17:44:27.584Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":430,"datetime":"2024-11-30T18:00:00.000Z","updatedAt":"2024-12-01T00:46:55.164Z","createdAt":"2024-11-27T18:43:11.646Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":426,"datetime":"2024-11-30T19:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T19:45:26.312Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":426,"datetime":"2024-11-30T20:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T20:43:11.151Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":444,"datetime":"2024-11-30T21:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T21:44:20.881Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":476,"datetime":"2024-11-30T22:00:00.000Z","updatedAt":"2024-12-01T00:47:09.213Z","createdAt":"2024-11-27T22:43:40.406Z","emissionFactorType":"lifecycle","isEstimated":false,"estimationMethod":null},{"zone":"US-MIDW-MISO","carbonIntensity":479,"datetime":"2024-11-30T23:00:00.000Z","updatedAt":"2024-12-01T01:43:31.842Z","createdAt":"2024-11-27T23:42:51.271Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":532,"datetime":"2024-12-01T00:00:00.000Z","updatedAt":"2024-12-01T02:44:36.340Z","createdAt":"2024-11-28T00:44:10.765Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":530,"datetime":"2024-12-01T01:00:00.000Z","updatedAt":"2024-12-01T03:43:54.479Z","createdAt":"2024-11-28T01:45:43.737Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":524,"datetime":"2024-12-01T02:00:00.000Z","updatedAt":"2024-12-01T04:44:10.981Z","createdAt":"2024-11-28T02:43:40.639Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":515,"datetime":"2024-12-01T03:00:00.000Z","updatedAt":"2024-12-01T05:44:26.608Z","createdAt":"2024-11-28T03:42:32.707Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":507,"datetime":"2024-12-01T04:00:00.000Z","updatedAt":"2024-12-01T05:44:26.608Z","createdAt":"2024-11-28T04:41:54.607Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"},{"zone":"US-MIDW-MISO","carbonIntensity":494,"datetime":"2024-12-01T05:00:00.000Z","updatedAt":"2024-12-01T05:44:10.595Z","createdAt":"2024-11-28T05:41:10.918Z","emissionFactorType":"lifecycle","isEstimated":true,"estimationMethod":"TIME_SLICER_AVERAGE"}]}
Loading

0 comments on commit 3e56a05

Please sign in to comment.