Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26655d3

Browse files
authored
Merge pull request ruvnet#133 from ruvnet/fix/pickle-deserialization-safety
fix: safe PyTorch model loading (weights_only=True)
2 parents 2ad5107 + aca1bbc commit 26655d3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

references/wifi_densepose_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def save_model(self, path):
441441
}, path)
442442

443443
def load_model(self, path):
444-
checkpoint = torch.load(path)
444+
checkpoint = torch.load(path, map_location=self.device, weights_only=True)
445445
self.model.load_state_dict(checkpoint['model_state_dict'])
446446
self.optimizer.load_state_dict(checkpoint['optimizer_state_dict'])
447447

0 commit comments

Comments
 (0)