Closed Howard-ll closed 3 years ago
TLDR
Try replacing
loaded_model = tf.saved_model.load(file_name)
by
loaded_model = tf.keras.models.load_model(file_name)
Details
The predict
method is not part of the TensorFlow SavedModel object itself.
Instead, it is created and restored by Keras (which is build on top of TensorFlow).
If you work work with Keras models, it is best to load them with tf.keras.models.load_model
.
tf.keras.models.load_model
Thanks! You are right.
Hi
Issue symptom When loaded a saved model from disk, predict is missing
How to reproduce 1) Create a model 2) Save it to disk 3) load it from disk 4) call model.predict (If I do like model(X, training=False), it works well)
AttributeError: '_UserObject' object has no attribute 'predict'
Thanks!