Skip to content

Commit 336f463

Browse files
committed
make update_* not abstract
1 parent e2dff99 commit 336f463

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

autointent/_callbacks/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ def log_final_metrics(self, metrics: dict[str, Any]) -> None:
6767
metrics: Final metrics.
6868
"""
6969

70-
@abstractmethod
7170
def update_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
7271
"""Update metrics during training.
7372
7473
Args:
7574
metrics: Metrics to update.
7675
"""
76+
return metrics
7777

78-
@abstractmethod
7978
def update_final_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
8079
"""Update final metrics.
8180
@@ -85,3 +84,4 @@ def update_final_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
8584
Returns:
8685
Updated final metrics.
8786
"""
87+
return metrics

autointent/_callbacks/tensorboard.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,3 @@ def end_module(self) -> None:
120120

121121
def end_run(self) -> None:
122122
"""Ends the current run. This method is currently a placeholder."""
123-
124-
def update_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
125-
return metrics
126-
127-
def update_final_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
128-
return metrics

autointent/_callbacks/wandb.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,3 @@ def end_run(self) -> None:
143143
144144
This method is currently a placeholder and does not perform additional operations.
145145
"""
146-
147-
def update_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
148-
return metrics
149-
150-
def update_final_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
151-
return metrics

tests/callback/test_callback.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ def end_run(self, **kwargs: dict[str, Any]) -> None:
4242
def log_final_metrics(self, **kwargs: dict[str, Any]) -> None:
4343
self.history.append(("log_final_metrics", kwargs))
4444

45+
def update_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
46+
self.history.append(("update_metrics", metrics))
47+
return metrics
48+
49+
def update_final_metrics(self, metrics: dict[str, Any]) -> dict[str, Any]:
50+
self.history.append(("update_final_metrics", metrics))
51+
return metrics
52+
4553

4654
def test_pipeline_callbacks(dataset):
4755
project_dir = setup_environment()

0 commit comments

Comments
 (0)