Skip to content

Commit

Permalink
Fix model loading issue with new lightning versions
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzLamm committed Oct 30, 2023
1 parent c132a79 commit 26db9de
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/membrain_seg/segmentation/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ def segment(
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Initialize the model and load trained weights from checkpoint
pl_model = SemanticSegmentationUnet()
pl_model = pl_model.load_from_checkpoint(model_checkpoint, map_location=device)
pl_model = SemanticSegmentationUnet.load_from_checkpoint(model_checkpoint, map_location=device, strict=False)
pl_model.to(device)

# Preprocess the new data
Expand Down

0 comments on commit 26db9de

Please sign in to comment.