Skip to content

Commit

Permalink
fix: fix bug in loading statedict
Browse files Browse the repository at this point in the history
  • Loading branch information
Alikerin committed Jan 10, 2025
1 parent 02f81f2 commit 536e118
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion instageo/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ def __init__(
if freeze_backbone:
for param in model.parameters():
param.requires_grad = False
_ = model.load_state_dict(checkpoint, strict=False)
filtered_checkpoint_state_dict = {
key[len("encoder.") :]: value
for key, value in checkpoint.items()
if key.startswith("encoder.")
}
_ = model.load_state_dict(filtered_checkpoint_state_dict)

self.prithvi_100M_backbone = model

Expand Down

0 comments on commit 536e118

Please sign in to comment.