Op 类型未在二进制中注册“SentencepieceEncodeSparse”

Yan*_*ang 7 tensorflow-serving

我已经部署了一个模型,该模型使用 tfhub 模型来使用 docker 进行 tensorflow 服务。

这是我的模型中包含的 tfhub 模型:

https://tfhub.dev/google/universal-sentence-encoder-multilingual/1

这是运行docker的命令

docker run -t --rm -p 8501:8501 \
    -v "/docker_dir/model_tf_serving:/models/mymodel" \
    -e MODEL_NAME=mymodel \
    tensorflow/serving &
Run Code Online (Sandbox Code Playgroud)

发生错误:

Not found: Op type not registered 'SentencepieceEncodeSparse' in binary running on c5e507bf091b. 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.
Run Code Online (Sandbox Code Playgroud)

那么有没有办法解决这个问题?

Tar*_*ula 0

您必须安装 TensorFlow 的句子模块:

pip install sentencepiece tf-sentencepiece
Run Code Online (Sandbox Code Playgroud)