nemo_automodel.components.loggers.metric_logger
nemo_automodel.components.loggers.metric_logger
Module Contents
Classes
Functions
Data
API
Simple JSON Lines logger.
- Appends one JSON object per line.
- Thread-safe writes via an internal lock.
- Creates parent directories as needed.
- UTF-8 without BOM, newline per record.
Write buffered records out. Caller must hold self._lock.
Write buffered records out to the file and fsync, without closing it.
Lets a caller align durability with an external event — a checkpoint boundary, say —
instead of relying on the record count happening to reach buffer_size there.
The fsync is unconditional, NOT gated on the flush= constructor flag. That flag
controls whether every buffer-size-triggered write pays for an fsync; this method is
an explicit, caller-chosen durability point, so it has to be durable under the
default flush=False too. Draining into the file object alone would leave the
records in the process’s stdio buffer — still lost to a crash, and invisible to
anything reading the file — which would make the guarantee empty exactly where it
is being relied on.
Single timestamped metrics record.
Build a local or distributed metric logger depending on distributed state.
Convert tensor metrics in buffered samples to CPU-backed scalar or list values.