Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keras model exported as TensorFlow model doesn't work with TensorFlow serving #38

Closed
ankushagarwal opened this issue Mar 9, 2018 · 8 comments

Comments

@ankushagarwal
Copy link

I am using the keras model as defined in this tutorial: https://github.com/hamelsmu/Seq2Seq_Tutorial/blob/master/notebooks/Tutorial.ipynb

I exported the encoder model using extract_encoder_model and exported it as a Tensorflow model. When used with TensorFlow serving, I get the following error

AbortionError: AbortionError(code=StatusCode.INVALID_ARGUMENT, details="Expected multiples argument to be a vector of length 3 but got length 2
[[Node: Encoder-Last-GRU_1/Tile = Tile[T=DT_FLOAT, Tmultiples=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Encoder-Last-GRU_1/ExpandDims, Encoder-Last-GRU_1/Tile/multiples)]]")

@jlewi
Copy link
Contributor

jlewi commented Mar 9, 2018

/cc @lakshmanok @nfiedel @rhaertel80

@jlewi
Copy link
Contributor

jlewi commented Mar 10, 2018

Could this be an issue with different versions of TF used for training and serving?

@ankushagarwal
Copy link
Author

It's unlikely. I ensured that both training and serving were done using tensorflow version 1.5.x

I did have a different error when I trained using TF 1.4 and served using TF 1.5.

@bkungfoo
Copy link

bkungfoo commented Mar 12, 2018

The TF serving images in Kubeflow are all 1.4 currently. I haven't tried creating a saved model with Keras in TF 1.5, but from my experience, creating an Estimator with TF 1.5 caused failures in TF serving 1.4. Not sure if Keras suffers from a similar issue with compatibility, although your case is the reverse. Did you try 1.4 for both training and serving?

I was able to run this one successfully with TF 1.4 training and serving.
https://github.com/google-aai/tf-serving-k8s-tutorial/blob/master/keras_resnet_serving_solution.ipynb

Here's the client to call the server:
https://github.com/google-aai/tf-serving-k8s-tutorial/blob/master/client/resnet_client.py

@bkungfoo
Copy link

The notebook link above is broken after a github update. I have an updated notebook here which includes not only creating servable models, but also some guidance on unit testing the input-output API: https://github.com/google-aai/tf-serving-k8s-tutorial/blob/master/keras_training_to_serving_solution.ipynb

@bkungfoo
Copy link

Created an issue: #48

@texasmichelle
Copy link
Member

I don't think we ever solved this, did we? Have there been any updates that would make this straightforward?

@stale
Copy link

stale bot commented Sep 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this as completed Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants