Skip to content

Commit

Permalink
implement TaskModule.configure_model_metric() (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBinder authored Dec 28, 2023
1 parent b28276b commit 4a23554
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pytorch_ie/core/taskmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import torch.utils.data.dataset as torch_dataset
from pytorch_lightning.core.mixins import HyperparametersMixin
from torchmetrics import Metric
from tqdm import tqdm

from pytorch_ie.core.document import Annotation, Document
Expand Down Expand Up @@ -447,3 +448,10 @@ def collate(
self, task_encodings: Sequence[TaskEncoding[DocumentType, InputEncoding, TargetEncoding]]
) -> TaskBatchEncoding:
pass

def configure_model_metric(self, stage: str) -> Optional[Metric]:
logger.warning(
f"TaskModule {self.__class__.__name__} does not implement a model metric. "
f"Override configure_model_metric(stage) to configure a metric for stage '{stage}'."
)
return None

0 comments on commit 4a23554

Please sign in to comment.