Skip to content

Commit

Permalink
Trainers: fix support for non-TensorBoardLogger (#1145)
Browse files Browse the repository at this point in the history
* Trainers: fix support for CSVLogger

* No need to check truthiness of attr

* Revert "No need to check truthiness of attr"

This reverts commit 450df6c.
  • Loading branch information
adamjstewart authored Feb 25, 2023
1 parent e81af42 commit be9d25c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchgeo/trainers/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def validation_step(self, *args: Any, **kwargs: Any) -> None:
and hasattr(self.trainer, "datamodule")
and self.logger
and hasattr(self.logger, "experiment")
and hasattr(self.logger.experiment, "add_figure")
):
try:
datamodule = self.trainer.datamodule
Expand Down Expand Up @@ -376,6 +377,7 @@ def validation_step(self, *args: Any, **kwargs: Any) -> None:
and hasattr(self.trainer, "datamodule")
and self.logger
and hasattr(self.logger, "experiment")
and hasattr(self.logger.experiment, "add_figure")
):
try:
datamodule = self.trainer.datamodule
Expand Down
1 change: 1 addition & 0 deletions torchgeo/trainers/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def validation_step(self, *args: Any, **kwargs: Any) -> None:
and hasattr(self.trainer, "datamodule")
and self.logger
and hasattr(self.logger, "experiment")
and hasattr(self.logger.experiment, "add_figure")
):
try:
datamodule = self.trainer.datamodule
Expand Down
1 change: 1 addition & 0 deletions torchgeo/trainers/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def validation_step(self, *args: Any, **kwargs: Any) -> None:
and hasattr(self.trainer, "datamodule")
and self.logger
and hasattr(self.logger, "experiment")
and hasattr(self.logger.experiment, "add_figure")
):
try:
datamodule = self.trainer.datamodule
Expand Down
1 change: 1 addition & 0 deletions torchgeo/trainers/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def validation_step(self, *args: Any, **kwargs: Any) -> None:
and hasattr(self.trainer, "datamodule")
and self.logger
and hasattr(self.logger, "experiment")
and hasattr(self.logger.experiment, "add_figure")
):
try:
datamodule = self.trainer.datamodule
Expand Down

0 comments on commit be9d25c

Please sign in to comment.