New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when loading a Subclass model with tf.keras.Sequential blocks inside #41045
Comments
Can you please provide colab link or complete code snippet along with supporting files to reproduce the issue in our environment.It helps us in localizing the issue faster.Thanks! |
Here comes the link: The last line loading a model causes the initialization error. Thanks! |
I have tried in colab with TF version 2.2,2.3-rc0,nightly versions and was able to reproduce the issue.Please, find the gist here.Thanks! |
Any updates? I'm looking forward to the solution. Thank you for the support! :) |
Any updates? I'm looking forward to the solution. Thank you for the support! :) |
I have tried in colab with TF version 2.3,nightly version( |
@jis478 Please let us know the update on this issue.Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you. |
Closing as stale. Please reopen if you'd like to work on this further. |
anyone has solved the problem? |
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
TensorFlow installed from (source or binary): pip install tensorflow-gpu
TensorFlow version: 2.2.0
Python version: 3.7.0
CUDA/cuDNN version: 11.0 / v8.0.1
GPU model and memory: NVIDIA V100
Problem encountered:
Problem encountered:
Please excuse me if this is not a bug but my lack of understanding on model saving. I will make it down right away if so.
I've written a code training ResNet-50 model using tf.keras.Model and tf.keras.layers.Layer APIs as below. As you can see, this a very common example of a Subclass model using tf.keras.Sequential() API as part of the model to stack Residual blocks.
The problem is that I can save the model without any issue using
model.save(MODEL_DIR, save_format='tf')
However, loading the trained model usingtf.keras.models.load_model(MODEL_DIR)
is a pain since it throws errors like the below. I'm wondering whether using tf.keras.Sequential() API inside tf.keras.Model class possibly causes this issue. The error seems to point out that something is missing with sequential blocks.Model construction
The text was updated successfully, but these errors were encountered: