Skip to content

Commit

Permalink
Use weights_only for load (#429)
Browse files Browse the repository at this point in the history
* Use weights_only for load

* Update botorch.py

* Update random_forest.py
  • Loading branch information
kit1980 committed Sep 14, 2024
1 parent 0b7a6b1 commit 09e9882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bofire/surrogates/botorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ def _dumps(self) -> str:
def loads(self, data: str):
"""Loads the actual model from a base64 encoded pickle bytes object and writes it to the `model` attribute."""
buffer = io.BytesIO(base64.b64decode(data.encode()))
self.model = torch.load(buffer)
self.model = torch.load(buffer, weights_only=False)
2 changes: 1 addition & 1 deletion bofire/surrogates/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ def _dumps(self) -> str:
def loads(self, data: str):
"""Loads the actual random forest from a base64 encoded pickle bytes object and writes it to the `model` attribute."""
buffer = io.BytesIO(base64.b64decode(data.encode()))
self.model = torch.load(buffer)
self.model = torch.load(buffer, weights_only=False)

0 comments on commit 09e9882

Please sign in to comment.