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
Saving broken between tf.keras and Keras Core #855
Comments
Can you print |
Here's the output of model summary. Model summary before saving:
Model summary before loading:
|
This is probably caused by a naming discrepancy. We should fix it. @nkovela1 do you have cycles to take a look? |
Also -- as a workaround, you can do |
I found the cause -- basically some change in TF seems to have broken the save file namespace in tf.keras (introduction of a |
Sure thing, I just created a Colab to inspect the h5 file and found that same discrepancy with |
This is now fixed at HEAD but the issue will persist in TF 2.13 and TF 2.14. Use |
Sounds good, thanks for the quick fix! |
I'm not following. Would you mind elaborating on where I should insert the code for the get_weights()/set_weights() workaround. I am using a script to load and use the model and that's wear the issue is happening. `import keras class_names = ['apple', 'banana', 'beetroot', 'bell pepper', 'cabbage', 'capsicum', 'carrot', 'cauliflower', 'chilli pepper', 'corn', 'cucumber', 'eggplant', 'garlic', 'ginger', 'grapes', 'jalepeno', 'kiwi', 'lemon', 'lettuce', 'mango', 'onion', 'orange', 'paprika', 'pear', 'peas', 'pineapple', 'pomegranate', 'potato', 'raddish', 'soy beans', 'spinach', 'sweetcorn', 'sweetpotato', 'tomato', 'turnip', 'watermelon'] image_path = "download.jpg" model = keras.models.load_model("TrainedModel.keras") img = tf.keras.utils.load_img( predictions = model.predict(img_array) print( |
Saving doesn't work between
tf.keras
andkeras_core
. More specifically, weights saved inkeras_core
don't load intf.keras
and vice versa.Here's a MRE:
Saving Script:
Model summary before saving:
Loading script:
Model summary before loading:
Error:
Versions:
The text was updated successfully, but these errors were encountered: