diff --git a/bofire/surrogates/botorch.py b/bofire/surrogates/botorch.py index cc42e6b9..6a17d51f 100644 --- a/bofire/surrogates/botorch.py +++ b/bofire/surrogates/botorch.py @@ -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) diff --git a/bofire/surrogates/random_forest.py b/bofire/surrogates/random_forest.py index 89d35d90..5ee805df 100644 --- a/bofire/surrogates/random_forest.py +++ b/bofire/surrogates/random_forest.py @@ -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)