Skip to content

Commit 2277eb5

Browse files
committed
Set weights_only explicitly
1 parent da2ec60 commit 2277eb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deepxde/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,9 @@ def restore(self, save_path, device=None, verbose=0):
11371137
self.net.load_weights(save_path)
11381138
elif backend_name == "pytorch":
11391139
if device is not None:
1140-
checkpoint = torch.load(save_path, map_location=torch.device(device))
1140+
checkpoint = torch.load(save_path, map_location=torch.device(device), weights_only=True)
11411141
else:
1142-
checkpoint = torch.load(save_path)
1142+
checkpoint = torch.load(save_path, weights_only=True)
11431143
self.net.load_state_dict(checkpoint["model_state_dict"])
11441144
self.opt.load_state_dict(checkpoint["optimizer_state_dict"])
11451145
elif backend_name == "paddle":

0 commit comments

Comments
 (0)