hello, how are you managing model persistence to b...
# ask-metaflow
h
hello, how are you managing model persistence to be able to reuse later? there are sklearn models that cant be loaded from the pickled file by metaflow. going further, do you use a separate package for the model registry or do you mimic it somehow with tags in metaflow?
1
v
if you have models that don't support Pickle, you can use their native serialization format. For instance this example uses Keras' own
save_model
so you can save a model in an artifact as
Copy code
self.model = KerasModel.save_model(model)
and load it like here:
Copy code
model = KerasModel.load_model(self.model)
👍 1
when you save your models as artifacts, they get persisted and versioned automatically, and their lineage is tied to the run and data that produced them. This covers a big part of benefits of a model registry
👍 1
in addition, if it's relevant for your use case, you can use tags to denote e.g. production versions of model. See examples in this article
👍 1