Comments (4)
@jianyizh your custom layer would need a build method. Keras 3 is more strict about this than tf_keras.
from keras.
@divyashreepathihalli I added the build method in the issue description, still the same error.
from keras.
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 doingmodel.set_weights(other_model.get_weights())
. You can use npz to store the output ofget_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.
Are you satisfied with the resolution of your issue?
Yes
No
from keras.
Related Issues (20)
- MultiHeadAttention is using unoptimised einsum equations HOT 5
- Invalid reduction dimension (2 for input with 2 dimension(s) [Op:Sum] HOT 4
- Error: unknown metric function HOT 1
- Inconsistent execution results by the PyTorch backend HOT 1
- "replication_pad1d" not implemented for 'Half' HOT 2
- Add 'pip install -r requirements.txt' to devcontainer.json to reduce contribution efforts HOT 2
- Loss and Gradients not correct when last batch has different size HOT 1
- support for dictionary-type loss functions without explicitly declaring `None` HOT 1
- Model.metrics_names not returning all metrics HOT 2
- Question about Memory Leak (all backends) HOT 7
- TextVectorization returns 'int64' vs 'float32' in TF 2.7 / nightly + Training simple unigram/bigram models much slower than in 2.15 HOT 2
- Custom `tf.keras.metrics.Metric` example fails on GPU in TF 2.17 (but not on nightly): is it possible to get it to work on 2.17? HOT 3
- Allow to pass **kwargs to optimizers.get HOT 1
- How to Convert Keras Modelโs Inference Method (with JAX Backend) to Flax Training State for Using Flax to Predict HOT 5
- Early-stopping does not work properly in Keras 3 when used in a for loop HOT 8
- Add AdEMAMix Optimizer HOT 4
- ValueError: File not found: filepath=Backend\C4__256g_000040000.keras. Please ensure the file is an accessible `.keras` zip file. HOT 6
- Model weights not saved if a custom layer class contains a list of layers named self._layers HOT 2
- Accessing the current training iteration step in a custom Layer class HOT 4
- Keras v3 equivalent for `get_output_at(num)` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras.