Skip to content

Commit

Permalink
provide specific exception
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Jan 7, 2025
1 parent 69f1e3b commit 692bcc7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/deepforest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from deepforest import evaluate as evaluate_iou

from huggingface_hub import PyTorchModelHubMixin
from lightning_fabric.utilities.exceptions import MisconfigurationException


class deepforest(pl.LightningModule, PyTorchModelHubMixin):
Expand Down Expand Up @@ -674,7 +675,7 @@ def validation_step(self, batch, batch_idx):
for key, value in loss_dict.items():
try:
self.log("val_{}".format(key), value, on_epoch=True)
except:
except MisconfigurationException:
pass

for index, result in enumerate(preds):
Expand Down Expand Up @@ -761,7 +762,7 @@ def on_validation_epoch_end(self):
output = {key: value for key, value in output.items() if not key == "classes"}
try:
self.log_dict(output)
except:
except MisconfigurationException:
pass
self.mAP_metric.reset()

Expand Down Expand Up @@ -831,12 +832,12 @@ def on_validation_epoch_end(self):
"{}_Precision".format(
self.numeric_to_label_dict[row["label"]]),
row["precision"])
except:
except MisconfigurationException:
pass
else:
try:
self.log(key, value)
except:
except MisconfigurationException:
pass

def predict_step(self, batch, batch_idx):
Expand Down

0 comments on commit 692bcc7

Please sign in to comment.