mmlearn.tasks.hooks module

Task-related hooks for Lightning modules.

class EvaluationHooks[source]

Bases: object

Hooks for evaluation.

evaluation_step(pl_module, batch, batch_idx)[source]

Run a single evaluation step.

Parameters:
  • pl_module (pl.LightningModule) – A reference to the Lightning module being evaluated.

  • batch (Any) – A batch of data.

  • batch_idx (int) – The index of the batch.

Returns:

A dictionary of evaluation results for the batch or None if no batch results are available.

Return type:

Optional[Mapping[str, Any]]

on_evaluation_epoch_end(pl_module)[source]

Run after the evaluation epoch.

Parameters:

pl_module (pl.LightningModule) – A reference to the Lightning module being evaluated.

Returns:

A dictionary of evaluation results or None if no results are available.

Return type:

Optional[Union[Mapping[str, Any]]]

on_evaluation_epoch_start(pl_module)[source]

Prepare the evaluation loop.

Parameters:

pl_module (pl.LightningModule) – A reference to the Lightning module being evaluated.

Return type:

None