Reputation: 3409
For.pb SavedModel : model.save("my_model")
default saves to .pb
For .tf SavedModel : model.save("my_model",save_format='.tf')
I would like to know the difference between these two formats. Are they both SavedModel? Are they both the same ? Which is better? Both are TensorFlow extension?
Upvotes: 5
Views: 3352
Reputation: 59701
See the documentation of tf.keras.Model.save
. save_format
can have one of two values:
tf
(default in TensorFlow 2.x) means TensorFlow format, a SavedModel protocol buffers file.h5
(default in TensorFlow 1.x) means the HDF5 Keras format, defined back when Keras was completely independent of TensorFlow and aimed to support multiple backends without being tied to anyone in particular.In TensorFlow 2.x you should not ever need h5
, unless you want to produce a file compatible with older versions or something like that. SavedModel is also more integrated into the TensorFlow ecosystem, for example if you want to use it with TensorFlow Serving.
Upvotes: 3