Spaces:
Sleeping
Sleeping
Update yolov5/models/experimental.py
Browse files
yolov5/models/experimental.py
CHANGED
|
@@ -82,10 +82,10 @@ def attempt_load(weights, device=None, inplace=True, fuse=True):
|
|
| 82 |
model = Ensemble()
|
| 83 |
|
| 84 |
for w in weights if isinstance(weights, list) else [weights]:
|
| 85 |
-
with torch.serialization.safe_globals([DetectionModel, Sequential, Conv]):
|
| 86 |
ckpt = torch.load(attempt_download(w), map_location='cpu') # safe load
|
| 87 |
ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
|
| 88 |
-
|
| 89 |
# Model compatibility updates
|
| 90 |
if not hasattr(ckpt, 'stride'):
|
| 91 |
ckpt.stride = torch.tensor([32.])
|
|
|
|
| 82 |
model = Ensemble()
|
| 83 |
|
| 84 |
for w in weights if isinstance(weights, list) else [weights]:
|
| 85 |
+
with torch.serialization.safe_globals([DetectionModel, Sequential, Conv, torch.nn.modules.conv.Conv2d]):
|
| 86 |
ckpt = torch.load(attempt_download(w), map_location='cpu') # safe load
|
| 87 |
ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
|
| 88 |
+
|
| 89 |
# Model compatibility updates
|
| 90 |
if not hasattr(ckpt, 'stride'):
|
| 91 |
ckpt.stride = torch.tensor([32.])
|