FIx downstream impact by the replacement of torch.load in ultralytics package (#13623)

* Update torch_load

* Auto-format by https://ultralytics.com/actions

---------

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Jing QiuandUltralyticsAssistant authored and GitHub committed 2025-07-04 12:07:46 +02:00
1 parent 79c4c31d16
commit 2540fd4c1c
9 files changed
+20 -12

No files matched your search

+2 -1
View File
@@ -9,6 +9,7 @@ from pathlib import Path
import torch
import yaml
from ultralytics.utils.patches import torch_load
FILE = Path(__file__).resolve()
ROOT = FILE.parents[2] # YOLOv5 root directory
@@ -18,7 +19,7 @@ if str(ROOT) not in sys.path:
port = 0 # --master_port
path = Path("").resolve()
for last in path.rglob("*/**/last.pt"):
ckpt = torch.load(last)
ckpt = torch_load(last)
if ckpt["optimizer"] is None:
continue