hub icon indicating copy to clipboard operation
hub copied to clipboard

Trying to use Universal Sentence Encoder Lite/2 via Tensorflow Serving

Open samitshah opened this issue 8 years ago • 4 comments

I created a SavedModel using the Universal Sentence Encoder Lite version. If I load the SavedModel using tf.saved_model.loader.load, it works perfectly fine.

However, if I try to serve the model using Tensorflow Serving, I'm getting the following error:

"error": "indices[3] = 1 is not in [0, 1)\n\t [[Node: lite_module_apply_default/Encoder_en/KonaTransformer/ClipToMaxLength/GatherV2_1 = GatherV2[Taxis=DT_INT32, Tindices=DT_INT64, Tparams=DT_INT64, _output_shapes=[[?]], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_qsph_v_0_7, lite_module_apply_default/Encoder_en/KonaTransformer/ClipToMaxLength/Reshape, lite_module_apply_default_1/Encoder_en/KonaTransformer/SequenceMask/Const)]]"

Any reasons on why that would be occurring?

tensorflow version: 1.9.0 tensorflow_hub version: 0.1.1 Using latest tensorflow/serving docker

samitshah avatar Oct 18 '18 11:10 samitshah

I am getting the exact same error message and can‘t find any help regarding this. Is there any fix or workaround yet? I tried to serve the model using Google AI Platform.

LukasHaas avatar Jun 17 '19 06:06 LukasHaas

Hi LukasHaas,

You might be using the RESTful Predict API and giving the input tensors in row format. Have you tried specifying the input tensors in columnar format? A more detailed reference can be found here

samitshah avatar Jun 17 '19 09:06 samitshah

Thank you so much for the quick response. While a columnar format was unfortunately not accepted by my API, I was able to reformat my input data using the row format according to your reference. Thanks :)

LukasHaas avatar Jun 17 '19 09:06 LukasHaas

Glad to help!

samitshah avatar Jun 17 '19 10:06 samitshah