From db128d89a869e4759904d9b5daea084448c7589b Mon Sep 17 00:00:00 2001 From: Shuqi XIAO Date: Wed, 5 Mar 2025 16:04:29 +0800 Subject: [PATCH] Fix for torch 2.6 In PyTorch 2.6, the default value of the *weights_only* argument in torch.load is changed from False to True. --- mobile_sam/build_sam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile_sam/build_sam.py b/mobile_sam/build_sam.py index 9a52c50..c9a51c8 100644 --- a/mobile_sam/build_sam.py +++ b/mobile_sam/build_sam.py @@ -88,7 +88,7 @@ def build_sam_vit_t(checkpoint=None): mobile_sam.eval() if checkpoint is not None: with open(checkpoint, "rb") as f: - state_dict = torch.load(f) + state_dict = torch.load(f, weights_only = False) mobile_sam.load_state_dict(state_dict) return mobile_sam