From e89974e4c95c2a4b9f464d8f21a01fe2ef3683c6 Mon Sep 17 00:00:00 2001 From: Shuqi XIAO Date: Wed, 5 Mar 2025 17:25:51 +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. --- models/experimental.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/experimental.py b/models/experimental.py index 735d7aa..e6c8f7a 100644 --- a/models/experimental.py +++ b/models/experimental.py @@ -249,7 +249,7 @@ def attempt_load(weights, map_location=None): model = Ensemble() for w in weights if isinstance(weights, list) else [weights]: attempt_download(w) - ckpt = torch.load(w, map_location=map_location) # load + ckpt = torch.load(w, map_location=map_location, weights_only = False) # load model.append(ckpt['ema' if ckpt.get('ema') else 'model'].float().fuse().eval()) # FP32 model # Compatibility updates