Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add TaskModule.configure_model_metric(stage) #392

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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