Skip to content

Commit

Permalink
fix: 🐛 Fix COSEM model loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoadesScholar committed Aug 13, 2024
1 parent 6a27504 commit 566ceed
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/cellmap_models/pytorch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import cosem
from . import cellpose
from . import cosem, cellpose, untrained_models
2 changes: 1 addition & 1 deletion src/cellmap_models/pytorch/cosem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Each model has a separate backbone and single layer prediction head. The `backbo
```python
import cellmap_models.cosem as cosem_models
model = cosem_models.load_model('setup04/1820500')
backnone = model.backbone
backbone = model.backbone
head = model.prediction_head
```

Expand Down
1 change: 1 addition & 0 deletions src/cellmap_models/pytorch/cosem/load_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def load_model(checkpoint_name: str) -> torch.nn.Module:
new_checkpoint["model"].pop(key)
continue
new_key = key.replace("architecture.", "")
new_key = new_key.replace("unet.", "backbone.")
new_checkpoint["model"][new_key] = new_checkpoint["model"].pop(key)
model.load_state_dict(new_checkpoint["model"])
model.eval()
Expand Down

0 comments on commit 566ceed

Please sign in to comment.