Sai Krishnadas
Sai Krishnadas

Reputation: 3409

What is the difference between .pb SavedModel and .tf SavedModel?

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

Answers (1)

javidcf
javidcf

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

Related Questions