eval.lm_evaluator¶
- class olmo_core.eval.lm_evaluator.LMEvaluator(*, name, batches, labels, device=None, deterministic=True)[source]¶
Bases:
EvaluatorLanguage modeling evaluator that computes cross entropy loss and perplexity over one or more datasets.
Important
The
batchesgenerated from these evaluators must contain a “metadata” field which should be a list of dictionaries, and each dictionary item in the list should contain a string field called “label” which indicates which dataset the data file is associated with, and should be included in thelabelsargument to this class.- Parameters:
- classmethod from_numpy_dataset(dataset, *, name, global_batch_size, collator, device=None, dp_process_group=None, seed=0, num_threads=None, num_workers=0, prefetch_factor=None, deterministic=True)[source]¶
Initialize an
LMEvaluatorfrom aNumpyPaddedFSLDataset.- Return type:
- update_metrics(batch, ce_loss, logits)[source]¶
Update metrics with from the
batchjust processed and the correspondinglogits.- Parameters:
- Return type:
- compute_metrics()[source]¶
Compute the final value of the metrics for the current evaluation loop. The metrics returned should already be reduced, if needed.
- reset_metrics()[source]¶
Reset metrics. Should be called after
compute_metrics().- Return type: