Skip to Content
0
Oct 09, 2019 at 02:21 PM

How to store model weights in an artifact and reload ?

373 Views Last edit May 27, 2020 at 02:01 PM 3 rev

Hi,

we want to use a ML scenario for a keras model.

We can train the model and store the model weights as artifact.

s_buf = io.StringIO()
model.keras_model.save_weights(s_buf)
api.send("modelBlob", s_buf.read())

However, we fail to load the weights from the artifact input when applying the model.

How would that be done in Python ?

This e.g. does not work when importing a blob from the artifact storage.

model.load_weights(modelBlob) 

Please advise.