eval.metrics

class olmo_core.eval.metrics.Metric(device=None, process_group=None)[source]

Bases: object

Base class for evaluation metrics.

abstract update(*args, **kwargs)[source]

Update the metric.

Return type:

None

abstract compute()[source]

Compute the metric.

Return type:

Tensor

abstract reset()[source]

Reset the metric.

Return type:

None

class olmo_core.eval.metrics.MeanMetric(device=None, process_group=None)[source]

Bases: Metric

Computes the mean over a stream of values.

update(value, weight=1.0)[source]
Parameters:
  • value (Union[float, Tensor]) – The latest value to update the metric with. Could be a tensor of values.

  • weight (Union[float, Tensor], default: 1.0) – The corresponding weight(s) for the value. Should be the same shape as value.

Return type:

None

compute()[source]

Computes the mean over the values and weights given.

Return type:

Tensor

reset()[source]

Reset the metric.

Return type:

None