I have made my own class subclassing tf.keras.Model
and am trying to save and load a trained instance of it. I'm trying to follow this tutorial but every time I go to load the saved model I get the same error message: TypeError: __init__() got an unexpected keyword argument 'reduction'
. I've tried adding that keyword argument to my class but it changes nothing. Any ideas?
I had the same problem for Tensorflow 1.14 and solved it by adding compile=False
to the load function:
new_model = tf.keras.models.load_model('saved_model/my_model', compile=False)
Even with compile=False
it is possible to run the model.predict()
function.
The solution originates from this Tensorflow issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With