Op type not registered 'SentencepieceOp' for Universal Sentence Encoder
See original GitHub issueDescription I am running into issues while trying to serve a TF HUB model on Triton. Model I am using is: https://tfhub.dev/google/universal-sentence-encoder-multilingual/3
Triton Information
I have reproduced this issue on following Triton versions: 21.04, 21.10 & 21.11
I am using the official Triton containers
docker pull nvcr.io/nvidia/tritonserver:21.xx-py3
To Reproduce
- Download the above model
- Generate config.pbtxt
- Start the triton server
- Load the model
- Send data for prediction (this step fails)
The error I get is
2021-11-23 02:27:50.394337: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:568] function_optimizer failed: Not found: Op type not registered ‘SentencepieceOp’ in binary running on db03c21d5f13. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)
tf.contrib.resampler
should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed. 2021-11-23 02:27:50.442544: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at partitioned_function_ops.cc:113 : Not found: Op type not registered ‘SentencepieceOp’ in binary running on db03c21d5f13. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.)tf.contrib.resampler
should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
Model framework, inputs, outputs & the model configuration file
name: “USEV3” platform: “tensorflow_savedmodel” input [ { name: “inputs”, data_type: TYPE_STRING, dims: [-1] } ] output [ { name: “outputs”, data_type: TYPE_FP32, dims: [-1, 512] } ] version_policy: { latest { num_versions : 1 }} optimization { graph { level: 1 } }
Expected behavior Successful output with a 512 dim vector for the prediction request
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
@shashankharinath I was seeing the protobuf mismatch because of the different versions of TF being used. pip installs the latest tensorflow-text which is for TF 2.x. For deploying the model with TF 1.x, we would need python=3.6, we can use the miniconda envioronment in the container. These steps deploy the model successfully:
TensorFlow 1
Within
nvcr.io/nvidia/tritonserver:21.10-py3
container:Follow below instructions only to test whether deployed model runs inferences without issue. These steps don’t validate the results.
Open another terminal and run
docker container ps
. Take note of the the Container ID running tritonserver.As it can be seen the model was successfully deployed and served. Look at this section to add validation logic. Instead of installing tritonclient pip package in the same container, you can use
tritonserver:21.10-py3-sdk
container as described here. It would require the port-forwarding to be enabled when launching the tritonserver container.TensorFlow 2
Within
nvcr.io/nvidia/tritonserver:21.10-py3
container:Conclusion
I have verified that Triton can load and run the TF-Text model successfully for both TF1 and TF2. Care must be taken that tensorflow-text version matches with the tensorflow version shipped with corresponding triton version. See support matrix for version information.
I did
pip install tensorflow_text
and loaded it in tritonserver as a custom op. It looks like there is a mismatch between protobuf versions in tf_text and tf in triton.The solution is to apply a small patch to TF-Text and Hub and building TF-Text from source code such that protobuf versions can match.