Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
110 views
in Technique[技术] by (71.8m points)

python - Save and load a concatenated Tensorflow model

I have a tensorflow Functional keras model made up of 2 separate Sequential models like so:

enter image description here

I want to deploy the model with tensorflow-serving and therefore need to save the model in 'tf' format. When I save the model, it creates the new model directory with the correct files and directories (assets, saved_model.pb, variables). However, when I try to re-load the model using model = tf.keras.models.load_model('./my_model_v1') it will not load. I don't get any error message but it just seems to sit there. I have left it run for over 30 minutes and nothing happens.

When I save the model in h5 format, it will load in seconds. Likewise, saving the individual sequential models in 'tf' format and then subsequently loading completes in a matter of seconds.

Why can I not load a model made up of these layers?

question from:https://stackoverflow.com/questions/65845136/save-and-load-a-concatenated-tensorflow-model

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...