From 0c2aef81114de38fc06e580f1f10902db3419b1c Mon Sep 17 00:00:00 2001 From: RollerKnobster Date: Tue, 25 Jun 2024 12:11:02 +0300 Subject: [PATCH] Fix: skip loading unitialized model from state 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. --- gordo/machine/model/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gordo/machine/model/models.py b/gordo/machine/model/models.py index b78abdaa7..10d169083 100644 --- a/gordo/machine/model/models.py +++ b/gordo/machine/model/models.py @@ -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)