Giter Club home page Giter Club logo

Comments (8)

sachinprasadhs avatar sachinprasadhs commented on June 22, 2024

Hi, As the warning suggests, HDF5 is a legacy format, it is suggested to use .keras for saving the model.

WARNING:absl:You are saving your model as an HDF5 file via model.save() or keras.saving.save_model(model). This file format is considered legacy. We recommend using instead the native Keras format, e.g. model.save('my_model.keras') or keras.saving.save_model(model, 'my_model.keras').

If you change the code model_file = "/tmp/model_weights.hdf5" to model_file = "/tmp/model_weights.keras" it will solve the issue. Thanks

from keras.

agreenbe0505 avatar agreenbe0505 commented on June 22, 2024

Do you say by this that the old keras2 saving format is unsupported in keras3?

from keras.

sachinprasadhs avatar sachinprasadhs commented on June 22, 2024

Do you say by this that the old keras2 saving format is unsupported in keras3?

It is supported, but it is suggested to use .keras format since it works seamlessly.

from keras.

agreenbe0505 avatar agreenbe0505 commented on June 22, 2024

OK, we could live with that, loading old models saved in legacy format and saving them in the new format.
But this also does not work when legacy custom layers exist in the model.
Attached 2 short snippets to demonstrate the problem.
One which stores the model is running in tf-2.8
The other which loads ther model is running in keras-3 tf-2.15
The load crashes with the error: AttributeError: 'CircleLayer' object has no attribute '_self_tracked_trackables'
load_legacy_model.py.txt
save_legacy_model.py.txt

from keras.

sachinprasadhs avatar sachinprasadhs commented on June 22, 2024

Saving in older version and loading it in Keras 3 may not work as expected, it is highly recommended to save the model in .keras and load it back in the same format, since it has all the model config details.
Note: From Keras 3, the only saving format is .keras

from keras.

fchollet avatar fchollet commented on June 22, 2024

Thanks for the report. I have fixed the issue with the legacy h5 format at HEAD.

from keras.

google-ml-butler avatar google-ml-butler commented on June 22, 2024

Are you satisfied with the resolution of your issue?
Yes
No

from keras.

sachinprasadhs avatar sachinprasadhs commented on June 22, 2024

Reference commit: 2c30d86

from keras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.