keras icon indicating copy to clipboard operation
keras copied to clipboard

Keras code example for TF serving

Open dimitreOliveira opened this issue 3 years ago • 2 comments
trafficstars

Hey there, I would be happy to write a Keras code example showcasing how to server Keras models using TF serving, let me know if you think that this would be useful, if yes it would be awesome if you can mention if you like to see something specific like serving vision, text, multiple models, or if just a minimal example would be fine.

dimitreOliveira avatar Sep 18 '22 19:09 dimitreOliveira

@dimitreOliveira, Could you please take a look at this official doc link and confirm if you are looking for the similar information? Thank you!

tilakrayal avatar Sep 20 '22 04:09 tilakrayal

Hi @tilakrayal , thanks for the reference, but I am actually offering to write a "Keras code example" on how to do that with different use cases that might be helpful for new users, what I would like to know is if the Keras team thinks that this could be a good addition or if it wouldn't add to much here.

dimitreOliveira avatar Sep 20 '22 18:09 dimitreOliveira

@dimitreOliveira Can you please let us know what usecases are you proposing? Thanks!!

gowthamkpr avatar Sep 22 '22 17:09 gowthamkpr

Hi @gowthamkpr ,

Since the code examples are usually small I have two ideas of how it could go:

  • Option 1: A two parts example where first I talk about TFServing, some best practices, etc and show how to serve a simple model (could be a vision model), in the second part I show how to create a custom signature that allows the user to embed the preprocessing and postprocessing logic and then serve the model with it, this is to showcase some of the advantages of TFServing.
  • Option 2: The code example would be a collection of different types of models being served with TFServing, vision model, text model, structured data model, maybe a GAN or some forest mode, could be anything just to show its flexibility.

Do you think that any of those ideas would turn into good code examples?

dimitreOliveira avatar Sep 22 '22 23:09 dimitreOliveira

It would be great fit for https://keras.io/examples/keras_recipes/ cc. @fchollet

innat avatar Sep 23 '22 12:09 innat

Does these all fit into a Colab notebook?

haifeng-jin avatar Sep 28 '22 22:09 haifeng-jin

https://www.tensorflow.org/tfx/tutorials/serving/rest_simple @dimitreOliveira Will the contributed tutorial different from this one?

haifeng-jin avatar Sep 29 '22 18:09 haifeng-jin

Hi @haifeng-jin , yes option 1 would be similar to that with some additional information about model signatures, I believe that it could fit well into a notebook. Another advantage is that we would have an example of that on the Keras code example page, it could be easier for new users to find it. Let me know if you think that it would be a good addition.

dimitreOliveira avatar Oct 01 '22 18:10 dimitreOliveira

Why use keras if you can use more dedicated inference frameworks such as tensorrt, openvino, onnx-runtime, TF ...

PierrickPochelu avatar Oct 01 '22 19:10 PierrickPochelu

I am not quite sure of what you mean here, but my idea is to create an example of serving Keras models with TFServing, both of them belong to the TensorFlow ecosystem.

dimitreOliveira avatar Oct 01 '22 19:10 dimitreOliveira

@dimitreOliveira Thank you! Wait for @fchollet comment before you start.

haifeng-jin avatar Oct 04 '22 23:10 haifeng-jin

Hi Dimitre,

Thanks for offering to write an example on TFServing + Keras, I think it would be valuable. You can just open a PR on https://github.com/keras-team/keras-io. I agree that option 1 (focus on best practices) is more helpful.

fchollet avatar Oct 05 '22 01:10 fchollet

Awesome, thank you very much guys, I will start working on this next week.

dimitreOliveira avatar Oct 06 '22 11:10 dimitreOliveira