Giter Club home page Giter Club logo

Comments (4)

divyashreepathihalli avatar divyashreepathihalli commented on September 25, 2024

@jianyizh your custom layer would need a build method. Keras 3 is more strict about this than tf_keras.

from keras.

jianyizh avatar jianyizh commented on September 25, 2024

@divyashreepathihalli I added the build method in the issue description, still the same error.

from keras.

fchollet avatar fchollet commented on September 25, 2024

The V3 Keras weights saving format does indeed rely on object class names in order to load weights correctly. So here's what you can do (each one of these options will work):

  • Rename your custom layer class Dense, the same as the original layer class.
  • Transfer weights without relying on the .weights.h5 format, for instance by doing model.set_weights(other_model.get_weights()). You can use npz to store the output of get_weights() to disk (it's a list of numpy arrays).
  • Edit the .weights.h5 file to rename the target "Dense" layer to "OptimizedDense" before loading.

from keras.

google-ml-butler avatar google-ml-butler commented on September 25, 2024

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

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.