Skip to content

Commit e98959f

Browse files
committed
fix: set weights_only=False when loading from pytorch
closes freqtrade#12964
1 parent 0a2c337 commit e98959f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

freqtrade/freqai/data_drawer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,13 @@ def load_data(self, coin: str, dk: FreqaiDataKitchen) -> Any:
614614
elif self.model_type == "pytorch":
615615
import torch
616616

617-
zipfile = torch.load(dk.data_path / f"{dk.model_filename}_model.zip")
618-
model = zipfile["pytrainer"]
619-
model = model.load_from_checkpoint(zipfile)
617+
zipfile = torch.load(
618+
dk.data_path / f"{dk.model_filename}_model.zip",
619+
weights_only=False,
620+
)
621+
# weights_only is necessary due to pytrainer being a serialized python object.
622+
_trainer = zipfile["pytrainer"]
623+
model = _trainer.load_from_checkpoint(zipfile)
620624

621625
if not model:
622626
raise OperationalException(

0 commit comments

Comments
 (0)