如何解决在TensorFlow服务中为USE4模型提供服务时表未初始化的问题? [英] How to resolve "Table not initialized" issue while serving USE4 model in tensorflow serving?

查看:1
本文介绍了如何解决在TensorFlow服务中为USE4模型提供服务时表未初始化的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我使用以下链接准备了一个包含USE4的Keras模型: https://tfhub.dev/google/universal-sentence-encoder-large/4

使用TensorFlow 2.3,我将其添加到我的模型中并保存该模型

tf.saved_model.save(
model,
export_dir= '/directory/model/1',
)

在docker中服务后,我可以获取元数据,但预测请求不起作用。以下是请求:

{"inputs":{"text":["Hello"]}}

响应:

{ "error": "[_Derived_]{{function_node __inference_pruned_16231}} {{function_node __inference_pruned_16231}} Table not initialized.
	 [[{{node text_preprocessor_1/hash_table_Lookup/hash_table_Lookup/LookupTableFindV2}}]]
	 [[StatefulPartitionedCall/StatefulPartitionedCall/sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/StatefulPartitionedCall]]" }
https://github.com/awslabs/amazon-sagemaker-examples/issues/773#issuecomment-509433290我在这里看到,在旧的tf版本中,可以通过在旧的tf.saveModel.Simple_save()函数中使用命令tf.ables_Initializer()来解决此问题。但在2.3.0中,替代方案是什么?

推荐答案

您是否可以使用该模型的版本5(link)重试?您的问题看起来与thisGitHub问题有关,该问题已使用模型的v5解决。如果这还不能解决问题,则复制该问题的最小代码片断将很有帮助。

这篇关于如何解决在TensorFlow服务中为USE4模型提供服务时表未初始化的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆