Skip to content
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

Compatibility Issue with Loading Model in Keras 3 #28

Closed
0saurabh0 opened this issue Mar 18, 2024 · 1 comment · Fixed by #29
Closed

Compatibility Issue with Loading Model in Keras 3 #28

0saurabh0 opened this issue Mar 18, 2024 · 1 comment · Fixed by #29

Comments

@0saurabh0
Copy link
Contributor

0saurabh0 commented Mar 18, 2024

when attempting to load pre-trained model in Keras 3, encountering issue:

ValueError: File format not supported: 
filepath=/home/srvk/Desktop/lstm_w/lstm_word_segmentation/Models/Thai_graphclust_model4_heavy. 
Keras 3 only supports V3 .keras files and legacy H5 format files (`.h5` extension). Note that the legacy SavedModel format is not 
supported by load_model() in Keras 3. In order to reload a TensorFlow SavedModel as an inference-only layer in Keras 3, use 
keras.layers.TFSMLayer(/home/srvk/Desktop/lstm_w/lstm_word_segmentation/Models/Thai_graphclust_model4_heavy

References:
related issue
docs

Environment:
TensorFlow Version: 2.16.1
Keras Version: 3.0.5

P.S. -- when I change the extension to .keras and then try to load the model, it says File not found: filepath="filepath" which is expected as the trained models are not in this format.

CC @sffc

@sffc
Copy link
Member

sffc commented Mar 18, 2024

Most of these models were trained in 2021 so it doesn't surprise me that the latest version of Keras has trouble reading them. I suggest following through with the steps outlined in the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants