nvalchemi.hooks.ScalarSnapshot#

class nvalchemi.hooks.ScalarSnapshot(*, stage, scalars, timestamp_s=<factory>, elapsed_s=None, event_count=None, step_count=None, batch_count=None, epoch_step_count=None, epoch=None, global_rank=0, messages=())[source]#

Scalar reporting payload for one hook event.

Parameters:
  • stage (str)

  • scalars (dict[str, float])

  • timestamp_s (float)

  • elapsed_s (float | None)

  • event_count (int | None)

  • step_count (int | None)

  • batch_count (int | None)

  • epoch_step_count (int | None)

  • epoch (int | None)

  • global_rank (int)

  • messages (tuple[ReporterMessage, ...])

stage#

Hook stage name associated with the snapshot.

Type:

str

scalars#

Flat scalar mapping using slash-separated semantic keys.

Type:

dict[str, float]

timestamp_s#

Wall-clock timestamp from time.time().

Type:

float

elapsed_s#

Seconds since the reporting state was created, when available.

Type:

float | None

event_count#

Reporting orchestrator event count, when available.

Type:

int | None

step_count#

Workflow step count from the hook context, when available.

Type:

int | None

batch_count#

Training batch count from the hook context, when available.

Type:

int | None

epoch_step_count#

Training epoch-local batch count from the hook context, when available.

Type:

int | None

epoch#

Training epoch from the hook context, when available.

Type:

int | None

global_rank#

Distributed rank from the hook context.

Type:

int

messages#

Recent reporting messages captured from the shared reporting state.

Type:

tuple[ReporterMessage, …]

as_dict()[source]#

Return a JSON-ready dictionary representation.

Returns:

Snapshot metadata plus the scalar mapping.

Return type:

dict[str, object]