tf.saved_model.save(model, path_to_dir) vs tf.keras.model.save.

171 views
Skip to first unread message

Rohan Mahajan

unread,
Mar 26, 2021, 10:04:39 PM3/26/21
to Keras-users
I have a keras model and want to save it a tensorflow graph. Is there a difference between tf.saved_model.save(model, path_to_dir) and tf.keras.model.save. In both of these, I want to save in a tensorflow saved format and will not be using h5 format. I understand tf.saved_model.save is more generic but if I am using a keras model are these two different in any ways. 

Lance Norskog

unread,
Mar 27, 2021, 4:14:11 AM3/27/21
to Rohan Mahajan, Keras-users
keras.model.save() might have more support for keras-specific classes, configs.
I do not know.

I've seen a lot of chatter about people saving and loading models, and the loaded model does not replicate the original numbers. Be careful on this topic!

On Fri, Mar 26, 2021 at 7:04 PM Rohan Mahajan <roh...@uplara.com> wrote:
I have a keras model and want to save it a tensorflow graph. Is there a difference between tf.saved_model.save(model, path_to_dir) and tf.keras.model.save. In both of these, I want to save in a tensorflow saved format and will not be using h5 format. I understand tf.saved_model.save is more generic but if I am using a keras model are these two different in any ways. 

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/87927ec6-a2d1-40da-a32b-c6d4411ce3ffn%40googlegroups.com.


--
Lance Norskog
lance....@gmail.com
Redwood City, CA

jim....@gmail.com

unread,
Mar 29, 2021, 1:26:33 PM3/29/21
to Keras-users
I use model.save(path) to save a Keras model in the saved_model format. Have you tried it with your model? You can verify and inspect the model file using the saved_model_cli utility.
Reply all
Reply to author
Forward
0 new messages