Giter Site home page Giter Site logo

Comments (10)

hanneshapke avatar hanneshapke commented on July 22, 2024 1

Hi @mironnn,

The tf.Example data structure is not intuitive. The data structure needs to be serialized and then encoded as base64 strings. I have created this Github gist with the example code (no error handling).

Let me know if you have any questions regarding the example. It works with the output of the latest BERT pipeline version and required a recent version of TF Serving.

from workshops.

hanneshapke avatar hanneshapke commented on July 22, 2024 1

In the coming days, I will publish a pipeline which doesn't require the tf.Example data structure.

from workshops.

rcrowe-google avatar rcrowe-google commented on July 22, 2024 1

@hanneshapke Thanks for the offer! I think the best place to document this would be in https://github.com/tensorflow/tfx/blob/master/docs/guide/keras.md

I would also be interested to include your Colab, probably under https://github.com/tensorflow/tfx/tree/master/docs/tutorials/serving

from workshops.

mironnn avatar mironnn commented on July 22, 2024

@hanneshapke maybe you can help me?
I would really appreciate it

from workshops.

mironnn avatar mironnn commented on July 22, 2024

@hanneshapke Thank you so much for your time and for the provided example.

Yeah, it would be great! It is very interesting to see how to make requests without preparation (serialization in the client) directly to the TF Serving with raw text.

from workshops.

hanneshapke avatar hanneshapke commented on July 22, 2024

Hi @mironnn,
Here is the example of the model export without the tf.Example requirement. Please note that if your model has multiple inputs, the TensorSpecs in the concrete_function() need to be adjusted. Those inputs also need to be consumed in serve_tf_examples_fn. I have added the REST request example without the tf.Example requirement to the end of the notebook.

Colab version of the BERT Pipeline which exports a model for simple REST requests:
https://colab.research.google.com/gist/hanneshapke/f0980b7422d367808dae409536fe9b46/tfx_pipeline_for_bert_preprocessing_wo_tf-example.ipynb

@rcrowe-google I think the TFX docs should mention the export of Keras models without the tf.Example dependency. I am happy to update the existing TFX documentation. Do you mind pointing me in the right direction where additional comments would be most appropriate?

@mironnn Let me know if you have any questions. I think we can close this issue.

from workshops.

rcrowe-google avatar rcrowe-google commented on July 22, 2024

@joeliedtke for reference

from workshops.

hanneshapke avatar hanneshapke commented on July 22, 2024

@rcrowe-google Thank you for your reply. I'll make those PRs tomorrow.
It seems to be timely. Someone else raised the question in tensorflow/tfx#1885

I will ping you and @joeliedtke when the PRs are ready for a review.

from workshops.

ucdmkt avatar ucdmkt commented on July 22, 2024

+1 to @hanneshapke

May we revise the demonstration of serving_input_fn() for model export to not receive 1-D Bytes Tensors and do parse_examples() in the serving graph, but simply receive flat list of raw Tensors? It's fine to receive serialized tf.Examples as input in training input_fn, but this characteristics doesn't have to carry over to serving_input_fn(), and doing so with Keras model is causing non-intuitive behavior like this issue and tensorflow/tfx#1885.

from workshops.

kylegallatin avatar kylegallatin commented on July 22, 2024

The tf.Example data structure is not intuitive. The data structure needs to be serialized and then encoded as base64 strings. I have created this Github gist with the example code (no error handling).

@hanneshapke is there an example for gRPC? I have b64 encoded data but can't find the right format to make the prediction over the protocol.

from workshops.

Related Issues (13)

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.