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

Fix wrong device error created by a breaking change in torch when using DDP #120

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# CHANGELOG

### 3.8.4
- fix: move IoU appropriately to fix wrong device error created by a breaking change in torch when using DDP.

### 3.8.3
- fix: prepare_data_per_node is a flag and was incorrectly used as a replacement for prepare_data.

Expand Down
2 changes: 1 addition & 1 deletion myria3d/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.8.3"
__version__ = "3.8.4"


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions myria3d/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def training_step(self, batch: Batch, batch_idx: int) -> dict:
return {"loss": loss, "logits": logits, "targets": targets}

def on_train_epoch_end(self) -> None:
iou_epoch = self.train_iou.compute()
iou_epoch = self.train_iou.to(self.device).compute()
self.log("train/iou", iou_epoch, on_step=False, on_epoch=True, prog_bar=True)
self.log_all_class_ious(self.train_iou.confmat, "train")
log_comet_cm(self, self.train_iou.confmat, "train")
Expand Down Expand Up @@ -186,7 +186,7 @@ def on_validation_epoch_end(self) -> None:
outputs : output of validation_step

"""
iou_epoch = self.val_iou.compute()
iou_epoch = self.val_iou.to(self.device).compute()
self.log("val/iou", iou_epoch, on_step=False, on_epoch=True, prog_bar=True)
self.log_all_class_ious(self.val_iou.confmat, "val")
log_comet_cm(self, self.val_iou.confmat, "val")
Expand Down Expand Up @@ -221,7 +221,7 @@ def on_test_epoch_end(self) -> None:
outputs : output of test

"""
iou_epoch = self.test_iou.compute()
iou_epoch = self.test_iou.to(self.device).compute()
self.log("test/iou", iou_epoch, on_step=False, on_epoch=True, prog_bar=True)
self.log_all_class_ious(self.test_iou.confmat, "test")
log_comet_cm(self, self.test_iou.confmat, "test")
Expand Down