Skip to content

Commit

Permalink
fix: loading secondary artifacts (#16)
Browse files Browse the repository at this point in the history
Signed-off-by: s0nicboOm <[email protected]>
  • Loading branch information
s0nicboOm committed Sep 21, 2022
1 parent 0c506bd commit f0b0d3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 8 additions & 6 deletions numalogic/registry/mlflow_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ def load(
run_data = self.client.get_run(run_id).data.to_dictionary()
if run_data["params"]:
data = run_data["params"]
secondary_artifacts = pickle.loads(
codecs.decode(data["secondary_artifacts"].encode(), "base64")
)
_LOGGER.info("Successfully loaded secondary_artifacts from Mlflow")
metadata = pickle.loads(codecs.decode(data["metadata"].encode(), "base64"))
_LOGGER.info("Successfully loaded model metadata from Mlflow")
if "secondary_artifacts" in data:
secondary_artifacts = pickle.loads(
codecs.decode(data["secondary_artifacts"].encode(), "base64")
)
_LOGGER.info("Successfully loaded secondary_artifacts from Mlflow")
if "metadata" in data:
metadata = pickle.loads(codecs.decode(data["metadata"].encode(), "base64"))
_LOGGER.info("Successfully loaded model metadata from Mlflow")
return self.__as_dict(model, secondary_artifacts, metadata, model_properties)
except Exception as ex:
_LOGGER.exception("Error when loading a model with key: %s: %r", model_key, ex)
Expand Down
3 changes: 1 addition & 2 deletions numalogic/tests/registry/test_mlflow_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def test_insert_model(self):
dkeys=dkeys,
primary_artifact=model,
secondary_artifacts=[make_pipeline(return_scaler)],
artifact_state_dict=model.state_dict(),
models_to_retain=2,
**model.state_dict(),
)
mock_status = "READY"
self.assertEqual(mock_status, status.status)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "numalogic"
version = "0.2.3"
version = "0.2.4"
description = "Collection of operational Machine Learning models and tools."
authors = ["Numalogic Developers"]
packages = [{ include = "numalogic" }]
Expand Down

0 comments on commit f0b0d3c

Please sign in to comment.