Skip to content

Commit

Permalink
fix sam hq and mobile sam loading with non cuda system (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
light-and-ray authored Feb 7, 2024
1 parent 2ba9dde commit b5be424
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
models/*/*.pth
models/*/*.pt
__pycache__
annotator
annotator
2 changes: 1 addition & 1 deletion sam_hq/build_sam_hq.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _load_sam_checkpoint(sam: Sam, checkpoint=None):
sam.eval()
if checkpoint is not None:
with open(checkpoint, "rb") as f:
state_dict = torch.load(f)
state_dict = torch.load(f, map_location="cpu")
info = sam.load_state_dict(state_dict, strict=False)
print(info)
for _, p in sam.named_parameters():
Expand Down

0 comments on commit b5be424

Please sign in to comment.