Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
fix(NeuralProphet): use their save & load method
Browse files Browse the repository at this point in the history
  • Loading branch information
almostintuitive committed Mar 23, 2023
1 parent 031baac commit 9e1afda
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/fold_models/neuralprophet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from copy import copy
from typing import Any, Optional, Union

import pandas as pd
Expand Down Expand Up @@ -40,16 +39,13 @@ def predict(self, X: pd.DataFrame) -> Union[pd.Series, pd.DataFrame]:
)

def __deepcopy__(self, memo):
model = copy(self.model)
setattr(model, "trainer", None)
from io import BytesIO

from torch import load, save
from neuralprophet.utils import load, save

buff = BytesIO()

save(model, buff)
save(self.model, buff)
buff.seek(0)
model = load(buff)
model.restore_trainer()
return NeuralProphetWrapper(model)

0 comments on commit 9e1afda

Please sign in to comment.