Skip to content

Commit

Permalink
Add weights_only param
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSamhuns committed Aug 7, 2024
1 parent bbb4e09 commit b489b62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _device(self):
return self.classifier_8.weight.device

def load_weights(self, path):
self.load_state_dict(torch.load(path))
self.load_state_dict(torch.load(path, weights_only=True))
self.eval()

def load_anchors(self, path, use_numpy=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def attempt_load(weights, map_location=None):
# Loads an ensemble of models weights=[a,b,c] or a single model weights=[a] or weights=a
model = Ensemble()
for w in weights if isinstance(weights, list) else [weights]:
model.append(torch.load(w, map_location=map_location)[
model.append(torch.load(w, map_location=map_location, weights_only=False)[
'model'].float().fuse().eval()) # load FP32 model

# Compatibility updates
Expand Down

0 comments on commit b489b62

Please sign in to comment.