Skip to content

Commit

Permalink
Update serialization.py
Browse files Browse the repository at this point in the history
Set weights_only in pytorch.load to False. This is a fix, but only models whose origin you trust should be loaded.
  • Loading branch information
bnebgen-LANL authored Nov 8, 2024
1 parent 6dd3a91 commit aa9fd4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hippynn/experiment/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ def load_saved_tensors(structure_fname: str, state_fname: str, **kwargs) -> Tupl
"""

with open(structure_fname, "rb") as pfile:
structure = torch.load(pfile, **kwargs)
structure = torch.load(pfile, weights_only=False, **kwargs)

with open(state_fname, "rb") as pfile:
state = torch.load(pfile, **kwargs)
state = torch.load(pfile, weights_only=False, **kwargs)
return structure, state


Expand Down

0 comments on commit aa9fd4b

Please sign in to comment.