GithubHelp home page GithubHelp logo

Comments (3)

fchollet avatar fchollet commented on May 19, 2024

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.

wamuir avatar wamuir commented on May 19, 2024

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:

"Use `tf.saved_model.save()` if you want to export a SavedModel "
"for use with TFLite/TFServing/etc. "

from keras.

fchollet avatar fchollet commented on May 19, 2024

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)

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.