mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 21:44:22 +08:00
Fix torch.load
Weights only load failed. Changed torch.load(file, map_location=cpu) to ckpt = torch.load(file, map_location=cpu, weights_only=False). Resolves #523. Credit goes to @allansdefreitas.
This commit is contained in:
parent
453c6e38a5
commit
8b84ade39b
@ -730,7 +730,7 @@ def torch_safe_load(weight):
|
|||||||
"ultralytics.yolo.data": "ultralytics.data",
|
"ultralytics.yolo.data": "ultralytics.data",
|
||||||
}
|
}
|
||||||
): # for legacy 8.0 Classify and Pose models
|
): # for legacy 8.0 Classify and Pose models
|
||||||
ckpt = torch.load(file, map_location="cpu")
|
ckpt = torch.load(file, map_location="cpu", weights_only=False)
|
||||||
|
|
||||||
except ModuleNotFoundError as e: # e.name is missing module name
|
except ModuleNotFoundError as e: # e.name is missing module name
|
||||||
if e.name == "models":
|
if e.name == "models":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user