Trainers: fix support for non-TensorBoardLogger (#1145)

* Trainers: fix support for CSVLogger

* No need to check truthiness of attr

* Revert "No need to check truthiness of attr"

This reverts commit 450df6c53c.
This commit is contained in:
Adam J. Stewart 2023-02-25 15:39:48 -07:00 коммит произвёл Caleb Robinson
Родитель 0a266b2a01
Коммит 6b1c2cc9cc
4 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -192,6 +192,7 @@ class ClassificationTask(pl.LightningModule):
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
@ -376,6 +377,7 @@ class MultiLabelClassificationTask(ClassificationTask):
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

Просмотреть файл

@ -230,6 +230,7 @@ class ObjectDetectionTask(pl.LightningModule):
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

Просмотреть файл

@ -149,6 +149,7 @@ class RegressionTask(pl.LightningModule):
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

Просмотреть файл

@ -202,6 +202,7 @@ class SemanticSegmentationTask(pl.LightningModule):
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