Package to monitor Goodput, Badput and other metrics of ML workloads.
Actively maintained. Last release 2 weeks ago, commits in 18 of the last 26 weeks. A safe choice.
pip install ml-goodput-measurementML Goodput Measurement
Goodput is the share of a training workload's wall-clock time spent on preserved, productive work: training steps that completed and were not lost to a restart or rollback. Badput is the remainder, attributed to its cause: accelerator initialization, program startup and compilation, data loading, checkpoint save and restore, evaluation and other custom events, disruptions and the progress they wasted. It is a workload-level metric: one number for the whole job, across all hosts and restarts, computed from the job's own timeline. Goodput says how much accelerator time became training progress; the Badput breakdown says what to fix.
ml-goodput-measurement records the timestamps that define these intervals
from any Python training loop (JAX, PyTorch, or any other framework), stores
them in Google Cloud Logging, and computes Goodput, the Badput breakdown and
step-time deviation on demand or continuously, with export to TensorBoard and
Google Cloud Monitoring for dashboards and alerting.
Install
pip install ml-goodput-measurement
Requires a Google Cloud project with the Cloud Logging API enabled; see Prerequisites.
Quick start
from ml_goodput_measurement import goodput
# Record from exactly one process per job (the lead process).
recorder = goodput.GoodputRecorder(
job_name=run_name, logger_name=f"goodput_{run_name}", logging_enabled=is_lead
)
recorder.record_job_start_time()
for step in range(num_steps):
recorder.record_step_start_time(step)
train_step()
recorder.record_job_end_time()
# Compute from anywhere with access to the project's logs.
calculator = goodput.GoodputCalculator(
job_name=run_name, logger_name=f"goodput_{run_name}"
)
goodput_pct, badput, last_step = calculator.get_job_goodput(
include_badput_breakdown=True
)
A 100-step run with checkpoints every 25 steps reports, for example:
| % of wall-clock | |
|---|---|
| Goodput | 52.5 |
| PROGRAM_STARTUP | 20.0 |
| UNPRODUCTIVE_CHECKPOINT_SAVE_TIME | 11.7 |
| OTHER | 8.0 |