Skip to content

Commit

Permalink
Fix: skip loading unitialized model from state
Browse files Browse the repository at this point in the history
This is due to the fact that `TransformedTargetRegressor` receives a `regressor` as input, then clones it for every `fit` and sets it to `regressor_`, leaving the original `regressor` uninitialized forever.
  • Loading branch information
RollerKnobster committed Jun 25, 2024
1 parent dd2f98a commit 0c2aef8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gordo/machine/model/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __getstate__(self):
return state

def __setstate__(self, state):
if "model" in state:
if "model" in state and state["model"] is not None:
with tempfile.NamedTemporaryFile("wb", suffix=".keras") as tf:
tf.write(state["model"])
state["model"] = load_model(tf.name, compile=False)
Expand Down

0 comments on commit 0c2aef8

Please sign in to comment.