Skip to content

Commit b5be424

Browse files
fix sam hq and mobile sam loading with non cuda system (#190)
1 parent 2ba9dde commit b5be424

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
models/*/*.pth
2+
models/*/*.pt
23
__pycache__
3-
annotator
4+
annotator

sam_hq/build_sam_hq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _load_sam_checkpoint(sam: Sam, checkpoint=None):
6464
sam.eval()
6565
if checkpoint is not None:
6666
with open(checkpoint, "rb") as f:
67-
state_dict = torch.load(f)
67+
state_dict = torch.load(f, map_location="cpu")
6868
info = sam.load_state_dict(state_dict, strict=False)
6969
print(info)
7070
for _, p in sam.named_parameters():

0 commit comments

Comments
 (0)