Skip to navigation
ReferenceFull Library ReferenceNemo AutomodelNemo AutomodelComponentsTrainingnemo_automodel.components.training.benchmark_summary

nemo_automodel.components.training.benchmark_summary

View as MarkdownOpen in Claude

End-of-run summary of a training recipe run as its performance benchmark.

benchmark: true (or --benchmark) runs a training recipe as its performance benchmark. Its summary averages the optimizer steps after ci.perf_testing.warmup_steps the way Core Models averages a performance run and the legacy benchmarking recipe averaged its timed iterations: the tokens of those steps over their time, and MFU weighted by step time. A step’s time is its token count over its tokens per second, two fields of its step line.

Module Contents

Classes

NameDescription
BenchmarkSummarySteady-state throughput of a benchmark run, over the steps after its warmup.
BenchmarkSummaryConfigTyped view over the summary of a benchmark run.
_Step-

Functions

NameDescription
format_benchmark_summaryThe log line of a summary from BenchmarkSummary.summarize.
write_benchmark_summaryWrite a summary as JSON, creating the parent directory.

Data

logger

API

class nemo_automodel.components.training.benchmark_summary.BenchmarkSummary(
)

Steady-state throughput of a benchmark run, over the steps after its warmup.

_steps
list[_Step] = []
nemo_automodel.components.training.benchmark_summary.BenchmarkSummary.record(
step: int,
tokens: float,
tokens_per_second: float,
mfu: float | None
) -> None

Add one optimizer step. A step without tokens has no time and is left out.

Parameters:

step
int

The step number of its step line.

tokens
float

Tokens of the step (num_tokens_per_step), the numerator of its tokens per second.

tokens_per_second
float

Global tokens per second of the step (tps).

mfu
float | None

MFU of the step in percent, or None when the model has no FLOPs formula.

nemo_automodel.components.training.benchmark_summary.BenchmarkSummary.report(
world_size: int
) -> dict[str, typing.Any]

Log the summary, and write it as JSON when the config names a path. Call it on one rank.

Parameters:

world_size
int

Number of GPUs.

Returns: dict[str, Any]

The summary, as summarize returns it.

nemo_automodel.components.training.benchmark_summary.BenchmarkSummary.summarize(
world_size: int
) -> dict[str, typing.Any]

Average the steps after the warmup, under the field names of the legacy benchmark summary.

Parameters:

world_size
int

Number of GPUs. The per-GPU throughput divides by it, as the step line does.

Returns: dict[str, Any]

total_steps, warmup_steps, training_steps, first_training_step,

class nemo_automodel.components.training.benchmark_summary.BenchmarkSummaryConfig(
warmup_steps: int = 0,
json_output_path: str | None = None,
global_batch_size: int | None = None,
local_batch_size: int | None = None
)
Dataclass

Typed view over the summary of a benchmark run.

global_batch_size
int | None = None

The run’s global batch size, reported next to the averages.

json_output_path
str | None = None

Where the summary is also written as JSON (ci.perf_testing.json_output_path), or None for the log line alone.

local_batch_size
int | None = None

The run’s local batch size, reported next to the averages.

warmup_steps
int = 0

Leading optimizer steps that the averages leave out (ci.perf_testing.warmup_steps).

An empty summary that the training loop records its steps into.

class nemo_automodel.components.training.benchmark_summary._Step(
step: int,
tokens: float,
seconds: float,
mfu: float | None
)
Dataclass
mfu
float | None
seconds
float
step
int
tokens
float
nemo_automodel.components.training.benchmark_summary.format_benchmark_summary(
summary: dict[str, typing.Any]
) -> str

The log line of a summary from BenchmarkSummary.summarize.

Parameters:

summary
dict[str, Any]

The summary to print.

Returns: str

benchmark summary: <n> steps after <w> warmup steps | avg step time <s> s | tps <x>(<y>/gpu) | mfu <z>,

nemo_automodel.components.training.benchmark_summary.write_benchmark_summary(
summary: dict[str, typing.Any],
path: str | pathlib.Path
) -> pathlib.Path

Write a summary as JSON, creating the parent directory.

Parameters:

summary
dict[str, Any]

The summary to write.

path
str | Path

The JSON file.

Returns: Path

The path written.

nemo_automodel.components.training.benchmark_summary.logger = logging.getLogger(__name__)