Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 why that would be occurring?

python version: 3.6

tensorflow version: 1.9.0

tensorflow_hub version: 0.1.1

Using tensorflow/serving docker 1.11

like image 930
sam Avatar asked Dec 03 '25 00:12

sam


1 Answers

I was giving the input tensors in row format. By changing the format of the input tensors to columnar format, I was able to rectify the issue. A detailed description of row and columnar formats can be found here.

like image 84
sam Avatar answered Dec 07 '25 18:12

sam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!