Tracking

RunHistory

class pytorch_accelerated.tracking.RunHistory[source]

The abstract base class which defines the API for a Trainer’s run history.

abstract property current_epoch: int

Return the value of the current epoch.

Returns:

an int representing the value of the current epoch

abstract get_latest_metric(metric_name)[source]

Return the most recent value that has been recorded for the given metric.

Parameters:

metric_name – the name of the metric being tracked

Returns:

the last recorded value

abstract get_metric_names() Iterable[source]

Return a set containing of all unique metric names which are being tracked.

Returns:

an iterable of the unique metric names

abstract get_metric_values(metric_name) Iterable[source]

Return all of the values that have been recorded for the given metric.

Parameters:

metric_name – the name of the metric being tracked

Returns:

an ordered iterable of values that have been recorded for that metric

abstract property metric_name_prefix
Returns:

the prefix which wil be prepended to any metric name

abstract reset()[source]

Reset the state of the RunHistory

abstract set_metric_name_prefix(prefix='')[source]

Set a prefix which will be prepended to any metric name which is tracked.

Parameters:

prefix – a prefix which will be prepended to any metric name which is tracked

abstract update_metric(metric_name, metric_value)[source]

Record the value for the given metric.

Parameters:
  • metric_name – the name of the metric being tracked

  • metric_value – the value to record

Implementations

class pytorch_accelerated.tracking.InMemoryRunHistory[source]

Bases: RunHistory

An implementation of RunHistory which stores all recorded values in memory.