Open ivanthecrazy opened 1 year ago
I think this is because your model includes custom layers or functions that are not tracked by Keras. try saving with h5 format:
model.save("saved_model", save_format='tf')
or you can save weight and biases and then import them
model.save_weights("model_weights.h5")
model.load_weights("model_weights.h5")
@ostadnavid I already opened another issue with saving weights and biases :)
Hi Ivan, can you link to the notebook you're working with here?
I'm currently working through trying to find a fix.
Seems to be older versions of TensorFlow working (e.g. 2.9.0) but later versions are causing errors with tf.keras.applications.efficientnet
models.
I see you posted here as well: https://github.com/mrdbourke/tensorflow-deep-learning/issues/544 (more info here)
Thank you for that, will try to sort both of these out.
Hi @ivanthecrazy , this may help , The problem is with the models rescaling layer.
At the top:
IMAGENET_STDDEV_RGB = [0.229, 0.224, 0.225]
IMAGENET_STDDEV_RGB = [1/math.sqrt(i) for i in IMAGENET_STDDEV_RGB]
Then on build just do:
x = layers.Rescaling(IMAGENET_STDDEV_RGB)(x)
!pip install tensorflow==2.9 pip install --force-reinstall -v protobuf==3.20.3
from tensorflow.keras import mixed_precision mixed_precision.set_global_policy(policy="float32") # set global policy to mixed precision
Thank you guys, with correct downgrade it seems to work
Section 8, video 189. I'm getting this error when saving the model:
I found out that tf downgrade to 2.9 should do the job, but I'm unable to install 2.9 on colab.