We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebd8eea commit 3cc639aCopy full SHA for 3cc639a
segment_anything/build_sam.py
@@ -89,7 +89,8 @@ def build_sam_vit_t(checkpoint=None):
89
mobile_sam.eval()
90
if checkpoint is not None:
91
with open(checkpoint, "rb") as f:
92
- state_dict = torch.load(f)
+ device = "cuda" if torch.cuda.is_available() else "cpu"
93
+ state_dict = torch.load(f, map_location=device)
94
info = mobile_sam.load_state_dict(state_dict, strict=False)
95
print(info)
96
for n, p in mobile_sam.named_parameters():
0 commit comments