Comments (3)
We don't recommend using tf.saved_model.save()
for writing a SavedModel from a Keras model.
The recommended way is model.export("path")
. If you call it on your model, you will see:
Saved artifact at 'path'. The following endpoints are available:
* Endpoint 'serve'
args_0 (POSITIONAL_ONLY): TensorSpec(shape=(None, 10), dtype=tf.int32, name='x')
Output Type:
TensorSpec(shape=(None, 2), dtype=tf.float32, name=None)
The input dtype and the input name are preserved. The output tensor name is not the name of the output layer, however. If you want to maintain that you will have to insert a tf.identity(..., name=...)
op at the end of your model.
If you need more granular control over the endpoints and their signatures, you should use keras.export.ExportArchive
.
If you want the behavior of tf.saved_model.save()
to match model.export()
, then you should file an issue with TensorFlow (we have no control over that function).
from keras.
Thanks! That helps a lot.
We don't recommend using tf.saved_model.save() for writing a SavedModel from a Keras model.
Here's what led me down that path:
keras/keras/saving/saving_api.py
Lines 110 to 111 in 5dd801a
from keras.
Good catch, we should update that comment. That path does work most of the time but it isn't nearly as reliable as the one we actually control (model.export()
).
from keras.
Related Issues (20)
- [BUG] Conflicting `loss_weights` implementation in Keras3 for single output case. HOT 6
- CategoryEncoding layer one hot indices cast to float in graph execution HOT 3
- Any method to get formulation of functions without seeking into source? HOT 2
- There seem some differences between the source code from PyPI and that tagged with v3.2.1 in GitHub. HOT 3
- Rescaling layer on input problems / ValueError: Layer node index out of bounds. inbound_layer = <InputLayer name=keras_tensorCLONE, built=True> HOT 1
- Conv3D crash when the data_format is 'channels_first' and using Tensorflow backend HOT 3
- Misspelled link. HOT 1
- imdb.load_data function returns a python list instead of ndarray object HOT 2
- Returning backend.set_learning_phase HOT 4
- Custom loss defined as a class instance vs function HOT 16
- Torch 2.3.0 (next ver) fails with AttributeError: 'Parameter' object has no attribute 'fget'
- Add support for jnp.linalg.slogdet HOT 2
- keras.layers.Layer.call method fails when building keras model with functional API HOT 1
- Getting Wrong output even though vgg16 model showing 95% val_accuracy HOT 3
- import keras error (V3.3.2) (kaggle Notebook) HOT 1
- Keras 3 with Pytorch backend ERROR - Layer 'lstm_cell' expected 3 variables, but received 0 variables during loading. Expected: ['kernel', 'recurrent_kernel', 'bias'] HOT 4
- The source code URL in the documentation leads to a non-existent page. HOT 1
- keras.ops.linalg.cholesky can't JIT HOT 1
- Model fails to train with Linux and Keras 3.3.2 HOT 9
- Compatible with .ogg format HOT 2
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.