xnn.common.train.loggers.Logger#

class xnn.common.train.loggers.Logger[source]#

Bases: object

Base class of the training loggers; override log_metrics() (and optionally the others).

The trainer calls the hooks on rank 0 only, so a logger never needs to know about distributed runs.

setup(output_dir)[source]#

Called once by the trainer with cfg.output_dir, before anything is logged.

Parameters:

output_dir (str) – The run’s output directory, the default place for log files.

Return type:

None

log_hyperparams(params)[source]#

Record the run configuration (the config as a nested dict) at the start of fit.

Parameters:

params (dict) – The full configuration, as written to a checkpoint’s config.yaml.

Return type:

None

log_metrics(metrics, step)[source]#

Record scalar metrics.

Parameters:
  • metrics (dict of str to float) – Metric names mapped to values.

  • step (int) – The number of optimizer steps taken so far.

Return type:

None

finalize(status)[source]#

Flush and close at the end of fit.

Parameters:

status (str) – "success", or "failed" when fit raised.

Return type:

None