Epoch Summary API¶
The durable JSONL summary records monitor MRR and unrounded epoch health values. Exact resume retains valid lines through the restored epoch, prunes later lines and continues in epoch order.
Durable epoch health values and monitor MRR beside the run's checkpoints (spec 4.4, P20).
EpochSummary
¶
Append each completed epoch's MRR and float64 health values to epoch_summary.jsonl.
The model starts it at fit start and appends after the refresh, monitor and health logs, before ModelCheckpoint saves. Exact resume keeps the lines through the restored epoch and drops a later interrupted segment's lines, as the monitor file does (spec 4.4).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, Path]
|
The summary file beside the run's checkpoints. |
required |
append(*, epoch, mrr, health)
¶
Append one completed epoch without rounding its health values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
int
|
The completed non-negative epoch, after every existing row. |
required |
mrr
|
Optional[float]
|
Finite validation MRR in [0, 1], or None without a monitor. |
required |
health
|
Mapping[str, float]
|
Finite loss, scale and radius values under the permitted health keys. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an epoch repeats or reorders the existing file, or a row is invalid. |
start(*, resumed_epoch)
¶
Refuse an existing fresh file or atomically prune a resumed file to its checkpoint epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resumed_epoch
|
Optional[int]
|
The restored checkpoint epoch, or None for a fresh run. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a fresh file exists, the resumed file is absent, the restored epoch is invalid, or any existing summary row is invalid. |
read_epoch_summary(path)
¶
Read the durable summary, in epoch order, skipping blank lines.
Rows hold epoch, mrr (None only without a monitor), and the flat P20 health keys as
Python numbers. No values are rounded or recovered from Lightning's callback metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, Path]
|
The run's durable summary file. |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
Validated rows in increasing epoch order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a row is invalid, nonfinite, repeats an epoch or is out of order. |
FileNotFoundError
|
If the summary does not exist. |